I'd also like to have the filled boxes in the legend to be striped. The
legend function has a 'density' attribute, but unfortunately this does't
seem to do anything
following the above example
legend(3.4, 5, c('Axx','Bxx','Cxx','Dxx'), fill = c('red', 'blue',
is the same as
legend(3.4, 5, c('Axx','Bxx','Cxx','Dxx'), density, fill = c('red',
'blue', 'green', 'orange'),
This appears to be a bug. Can you file a bug report for this please?
In the above example R warns that 'border' is not used yet. Does that
change soon? Basically I'd like the border of each bar to be black
rather than the fill color.
I'm not sure when this might get implemented properly -- in the meantime,
here's a small extension of the example that will "cheat" to give the effect
I think you want ...
m <- matrix(runif(30), ncol=5)
barplot(m, besideúLSE, col=rep(c("white", "light green", "pink"), 2),
xlim=c(0, 6), axesúLSE)
barplot(m, besideúLSE, col="blue",
density=rep(c(10, 5, -1), 2),
angle=rep(c(45, -45, 0), 2), horiz=TRUE,
barplot(m, besideúLSE, col="black", density=-1,
However, isn't it a logic step to implement the density attribute of the
barplot in a way that one can mix filled bars with stiped bars? E.g
barplot(..., besides = FALSE, horiz = TRUE, col = c('red', 'blue',
density = c(-1,0,-1,10))
where a density value of 0 means no density AND no filling (empty, just
border), a negative value means complete filling with no stipes and a
positve value means actually stiping with that density valie.
There are a number of places in R where several graphics parameters interact
with each other in a nasty way. Suggestions for clarifications like this
are very welcome. But even better would be a patch for the barplot code
that implemented the change :)
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch