[R] rainbow producing colors that do not differ sufficiently
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sun Mar 10 16:45:45 CET 2013
See the CRAN task view on Graphics and its section on colors:
http://cran.r-project.org/web/views/Graphics.html
Uwe Ligges
On 06.03.2013 18:09, Fisher Dennis wrote:
> R 2.15.2
> OS X
>
> Colleagues,
>
> I often use rainbow to select colors. I encountered a surprise with rainbow(11). It yielded three greens (in positions 4-6). The first two of these are quite similar. The man pages suggest that this might be the case:
> equispaced hues in RGB space tend to cluster at the red, green and blue primaries
>
> The following code illustrates the problem -- the colors labeled 4 and 5 are quite similar.
> plot(1, type="n", xlim=c(1, 10), ylim=c(0, 1), axes=F, xlab="", ylab="")
> for (which in 3:7)
> {
> rect(which - 1, 0, which, 1, border=NA, col=rainbow(11)[which])
> text(which - 0.5, 0.8, which)
> text(which - 0.5, 0.2, rainbow(11)[which], srt=90)
> }
>
> In this case, I overcame the problem by replacing one element on the rainbow vector with a different green.
>
> Is there some better approach to this by which I could automate the entire process but prevent this similarity of colors?
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.com
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list