1 |
x |
|
legend.text |
|
col |
|
ylab |
|
xlab |
|
bar.ylim |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, legend.text = NULL, col = NULL, ylab = NULL, xlab = NULL,
bar.ylim = NULL)
{
n = ncol(x)
p = nrow(x)
xpos = (abs(x) + x)/2
xneg = (x - abs(x))/2
if (is.null(bar.ylim)) {
ymax <- max(colSums(xpos, na.rm = T))
ymin <- min(colSums(xneg, na.rm = T))
ylim = c(ymin, ymax)
}
else {
ylim = bar.ylim
}
barplot(xpos, legend.text = legend.text, col = col, ylab = ylab,
xlab = xlab, args.legend = list(x = 1.2, y = bar.ylim[2],
cex = 0.5), ylim = bar.ylim)
barplot(xneg, add = T, col = col)
abline(h = 0)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.