xts
xts copied to clipboard
plot.xts - add stacked bar chart.type
We can get really close to doing stacked/unstacked bar charts by replacing chart.lines
within plot.xts
with the following:
chart.bars <- function(x, colorset=1:10, ...){
positives = negatives = x
for(column in 1:NCOL(x)){
for(row in 1:NROW(x)){
positives[row,column]=max(0,x[row,column])
negatives[row,column]=min(0,x[row,column])
}
}
barplot(t(positives), add=TRUE, col=colorset, axisnames = FALSE, axes = FALSE, ...)
barplot(t(negatives), add=TRUE , col=colorset, axisnames = FALSE, axes = FALSE, ...)
}
It would still need some parameterization to get the geometry correct.
https://github.com/joshuaulrich/xtsExtra/issues/14