Hi,
In barplot(height, col = ...), the col = vector recycles so that the
same colors are used for each bar. I would like to use different colors
in different bars (corresponding to another piece of information, here,
the region of the country being represented).
For example,
x = matrix(c(5,2,3,1),nrow=2)
barplot(x,col=1:4)
will draw two bars with two segments each, but each colored red and
black rather than red and black for the first bar, then green and blue
for the second.
I see in the archives that someone asked this question before, and got a
single reply (as far as I could tell) suggesting that s/he forget
barplot and use rect(). That's kind of a pain, so I'm wondering if
there is any simpler way of tricking barplot() into doing this.
Thanks,
Jim Fearon
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.