[R] assigning colors to barplot when beside=TRUE
Alejandro Munoz Del Rio
munoz at cs.wisc.edu
Fri Dec 5 00:12:54 CET 2003
Quoting Paul Murrell <p.murrell at auckland.ac.nz>:
> I haven't figured out exactly what your code is supposed to produce, but
> I suspect that you are calculating colv incorrectly. In your example,
> you get a colv with 5 elements. There are a total of 10 bars plotted
> (some are zero height because the value they are plotting is NA). The
> colours get applied to bars from left to right so in your case we get:
>
> bar height: 7 NA 6 NA 1 NA NA 4 NA 3
> bar colour: 2 3 2 NA NA 2 3 2 NA NA
[snip]
your hunch is correct. setting:
colv <- rep(colv, each=2)
to "echo" each entry in the old colv solves my problem. i was not aware of the
zero-height bars.
thanks!
alejandro
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
More information about the R-help
mailing list