spiral_bars: Add bars to a track

View source: R/graphics.R

spiral_barsR Documentation

Add bars to a track

Description

Add bars to a track

Usage

spiral_bars(
  pos,
  value,
  baseline = get_track_data("ymin", track_index),
  bar_width = min(diff(pos)),
  gp = gpar(),
  track_index = current_track_index()
)

Arguments

pos

X-locations of the center of bars.

value

Height of bars. The value can be a simple numeric vector, or a matrix.

baseline

Baseline of the bars. Note it only works when value is a simple vector.

bar_width

Width of bars.

gp

Graphical parameters.

track_index

Index of the track.

Value

No value is returned.

Examples


x = seq(1, 1000, by = 1) - 0.5
y = runif(1000)
spiral_initialize(xlim = c(0, 1000))
spiral_track(height = 0.8)
spiral_bars(x, y)

# a three-column matrix
y = matrix(runif(3*1000), ncol = 3)
y = y/rowSums(y)
spiral_initialize(xlim = c(0, 1000))
spiral_track(height = 0.8)
spiral_bars(x, y, gp = gpar(fill = 2:4, col = NA))


spiralize documentation built on June 22, 2024, 10:45 a.m.