[R] How can I create colors correspond to the number of a variable?
john.archie.mckown at gmail.com
Wed Sep 17 10:26:58 CEST 2014
First off, please post in plain text not HTML. It is a forum
requirement. HTML posts are often ignored, especially if they look
"messy" in plain text, which is all that the mailing list software
distributes. It strips off the HTML portion entirely.
Your question is vague in that you didn't indicate what you wanted in
the way of colors and what you were going to do with them. For
plotting? For visually distinguishing one out of 4,000 possible beds
by color on a screen display? If you want plotting, then use ggplot2
and the scale_color_brewer() function:
http://docs.ggplot2.org/current/scale_brewer.html . My personal
opinion is that it is unlikely that an average person will be able to
memorize 4,000 different colors, be able to see one of them, and say
definitively "that is bed number ---". Especially if the person is
even mildly color blind. Depending on use, the U.S. ADA (American with
Disabilities Act) may become a factor. Companies need to remember
this. Individuals, not so much.
But rather than give any real opinion about this question, I will just
point out some archive messages which might be of some help.
This doesn't address R, but does address the use of color, and gives a
reference to the R color brewer (http://colorbrewer2.org/)
Pantone, an industry standard in color, has 2,058 colors in their Goe inventory:
This site might help you select the colors:
And I do know that I did not directly answer your question with a
piece of code.
On Tue, Sep 16, 2014 at 11:34 PM, wszsdmjj <wszsdmjj at 163.com> wrote:
> I need to create a color vector with 4000 colors, and I have another
> variable, it contains 4000 element. If my variable is number of bed, and I
> want the color corresponds to the number of bed in this variable. How should
> I do?
> View this message in context: http://r.789695.n4.nabble.com/How-can-I-create-colors-correspond-to-the-number-of-a-variable-tp4697052.html
> Sent from the R help mailing list archive at Nabble.com.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
There is nothing more pleasant than traveling and meeting new people!
More information about the R-help