bibar | R Documentation |
Plot a bi-directional bar plot with optional side bars.
bibar(
x,
left = NULL,
right = NULL,
sleft = NULL,
sright = NULL,
col = NULL,
xlim = NULL,
ylim = NULL,
axes = TRUE
)
x |
a table- or matrix-like object |
left, right |
a vector of integers giving the column indices of
|
sleft, sright |
as above but bars drawn from the left or right side to the origin |
col |
a vector of colors for each column |
xlim, ylim |
x- and y-axis limits |
axes |
logical; if |
prettybars2
set.seed(1)
x <- datasets::ability.cov$cov
x <- x[sample(seq.int(nrow(x)), 20, TRUE), ]
bibar(x, left = 1:3, right = 4:6, xlim = c(-250, 250))
palette(c('grey90', 'cornflowerblue', 'blue', 'tomato', 'tomato3'))
bibar(x, left = 2:3, right = 4:5, sleft = 1, sright = 6)
legend('topleft', inset = c(0, -0.2), xpd = NA, fill = 3:2,
legend = colnames(x)[3:2], horiz = TRUE, bty = 'n')
legend('topright', inset = c(0, -0.2), xpd = NA, fill = 4:5,
legend = colnames(x)[4:5], horiz = TRUE, bty = 'n')
palette('default')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.