Description Usage Arguments Details Value Author(s) Examples
A barplot method for xts objects.
1 2 3 4 5 6 7 | ## S3 method for class 'xts'
barplot(height, stacked = TRUE, scale = FALSE, auto.legend = TRUE,
major.format = TRUE, ylim=NULL, space = 0.2, cex.axis=0.8,
cex.legend = 0.8, cex.lab = 1, cex.labels = 0.8, cex.main = 1,
xaxis=TRUE, box.color = "black", xlab="Date",
ylab="Value", major.ticks='auto', minor.ticks=TRUE,
xaxis.labels = NULL, col, ...)
|
height |
An |
stacked |
logical. Should barplot be stacked? |
scale |
logical. Should data be rescaled to sum to 100% at each bar? Currently does not support negative values. |
auto.legend |
logical. Should a legend be placed underneath the barplot? |
major.format |
Format string for x-axis time labels. If |
ylim |
Limits of y-axis. If |
space |
the amount of space (as a fraction of the
average bar width) left before each bar, as in
|
cex.axis |
The magnification to be used for sizing
the axis text relative to the current setting of 'cex',
similar to |
cex.legend |
The magnification to be used for sizing
the legend relative to the current setting of 'cex',
similar to |
cex.labels |
The magnification to be used for event line labels relative to the current setting of 'cex'. |
cex.lab |
The magnification to be used for x- and y-axis labels relative to the current setting of 'cex'. |
cex.main |
The magnification to be used for the chart title relative to the current setting of 'cex'. |
xaxis |
If true, draws the x axis |
box.color |
provides the color for drawing less-important chart elements, such as the box lines, axis lines, etc. |
xlab |
the x-axis label, which defaults to |
ylab |
Set the y-axis label, same as in |
major.ticks |
Should major tickmarks be drawn and labeled? Default |
minor.ticks |
Should minor tickmarks be drawn? default |
xaxis.labels |
Allows for non-date labeling of date axes, default is |
col |
Color of the bars. If missing, defaults to the somewhat garish colors provided by |
... |
additional graphical arguments passed to |
Used to provide time-oriented barplots.
Invisibly returns the plotted object. Also assigns .barplot.xts
to .GlobalEnv
which can be used to "replay" the plot.
Peter Carl with modifications by Michael Weylandt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | weights <- xts(matrix(runif(42, 0.1, 0.3), ncol = 6), as.yearmon(Sys.Date()) + 0:6)
names(weights) <- paste("Factor", LETTERS[1:6])
barplot(weights)
# No legend
barplot(weights, auto.legend = FALSE)
# Not Stacked
barplot(weights, stacked = FALSE)
# Scale weights to sum to 1
barplot(weights, scale = TRUE)
# A nicer color pallette
# rainbow6equal from Performance Analytics
barplot(weights, scale = TRUE, col = c("#BF4D4D", "#BFBF4D", "#4DBF4D", "#4DBFBF","#4D4DBF", "#BF4DBF"))
# Include negative data
weights[,3] <- weights[,3] * -1
barplot(weights)
barplot(weights, stacked = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.