Skip to content

color palettes

5 messages · carol white, Mark Knecht, Sarah Goslee +2 more

#
?rainbow
?col2rgb

rainbow(8)
col2rgb(rainbow(8)[5])

col2rgb(rainbow(8)[5])[1]
col2rgb(rainbow(8)[5])[2]
col2rgb(rainbow(8)[5])[3]
On Fri, Aug 8, 2014 at 6:26 AM, carol white <wht_crl at yahoo.com> wrote:
#
You might take a look at the RColorBrewer package.

Sarah
On Fri, Aug 8, 2014 at 9:26 AM, carol white <wht_crl at yahoo.com> wrote:

  
    
#
I think your question is too vague to answer since we don't know what you are trying to do or how many colors you need. The easy answer is that you don't need to use rainbow() at all, just use color names:

mycolors <- c("red", "green", "blue", "violet")

and you will have one of each. For example, col=mycolors(2) will plot using green (and so will col="green"). There are lots of color names in R:
[1] 502

The longer answer is that there are many color palettes and ways of selecting, manipulating, and choosing colors. The built in functions include palettes such as rainbow, heat.colors, terrain.colors, topo.colors, cm.colors, and gray and ways of specifying colors (in addition to using names) including rgb, hsv, and hcl. In addition, there are several packages for creating color palettes including RColorBrewer, colortools, colorspace, and munsell.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of carol white
Sent: Friday, August 8, 2014 8:27 AM
To: r-help at r-project.org
Subject: [R] color palettes

Hi,
Is there any way to take one color of each color family from a color palettes like rainbow? For ex, if there are different blues differentiated by intensity, hue etc, taking one of them. In this case, when using rainbow(n), then how to select 1 color of each family, for ex 1 blue, 1 red etc? It doesn't matter which intensity, hue etc is taken as long as 1 color from each family is taken.


Thanks

Carol


______________________________________________
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.
#
On Fri, 8 Aug 2014 06:26:35 AM carol white wrote:
differentiated
red
color
Hi Carol,
Since you have asked a question about a fundamental aspect of 
graphic representation, I'll try to answer it. Be warned, it will be a 
rather discursive answer.

Whenever we try to communicate information about a number of 
things, where the information is different for each thing, it is essential 
to securely link the correct information to each thing. In compact 
graphic representations such as R plots, this usually resolves to labels 
of some sort. So we could construct a pie chart of the number of 
emails sent by each person in the present discourse using the names 
of the people involved. If we simply label each sector of the resulting 
plot with the names of the people, it will be reasonably informative in 
displaying each person's contribution.

If we venture beyond the comfortable pale of the R help list and try to 
do this with something like Twitter, where I understand there may be 
thousands or even millions of contributors on a subject, the pie chart 
blurs into a chromatic dazzle with an unintelligible fringe of names. We 
might try to rescue the situation by aggregating the tweets into a few 
categories such as helpful, sarcastic and noise, but this does not solve 
the problem of how to display the comparative contributions of the 
twits involved.

So one answer to your question of "How can I intelligibly label 
hundreds of things with colors?" may be "You can't unless your 
audience is made up of spectrographs." Plots that attempt to display 
information about too many things using line types, symbol types and 
colors often simply confuse the audience.

My feeling is that it is the responsibility of the person choosing the 
method of communication to make sure that it communicates well. So 
if we want to display something meaningful about the hypothetical 
pandemonium of tweets above, we might choose to display the 
categories (helpful, sarcastic and noise) broken down by the sex of the 
twits. Perhaps in your case you might want to break down the 
functional category of the genes you are examining by the up- or 
down-regulation of those genes in different cell types.

Your question touches things like "How many letters should there be in 
the alphabet?" and "How many acronyms for psychological tests can 
be meaningfully used in a paragraph?" At any rate, I thank you for 
giving me an idea about graphic illustration.

Jim