spiral_bars: Add bars to a track

Description Usage Arguments Value Examples

View source: R/graphics.R

Description

Add bars to a track

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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 Feb. 6, 2022, 1:06 a.m.