[R] bug/feature with barplot?
Karin Lagesen
karin.lagesen at medisin.uio.no
Mon Nov 14 15:55:09 CET 2005
I have found a bug/feature with barplot that at least to me shows
undesireable behaviour. When using barplot and plotting fewer
groups/levels/factors(I am unsure what they are called) than the number
of colors stated in a col statement, the colors wrap around such that
the colors are not fixed to one group. This is mostly problematic when
I make R figures using scripts, since I sometimes have empty input
groups. I have in these cases experienced labeling the empty group as
red, and then seeing a bar being red when that bar is actually from a
different group.
Reproducible example (I hope):
barplot(VADeaths, beside=TRUE, col=c("red", "green", "blue", "yellow", "black"))
barplot(VADeaths[1:4,], beside=TRUE, col=c("red", "green", "blue", "yellow", "black"))
Now, I don't know if this is a bug or a feature, but it sure bugged me...:)
Karin
--
Karin Lagesen, PhD student
karin.lagesen at medisin.uio.no
http://www.cmbn.no/rognes/
More information about the R-help
mailing list