[R] Attempting to make a custom color spectrum to use inheatmap.2

Daniel Bernstein bernsted at reed.edu
Thu Aug 7 22:36:19 CEST 2008


Thanks everyone for the great responses! The

col = c("grey", "black", rainbow(50) )

idea was the easiest for me to figure out how to implement, but the 
others look like the can do what I want as well. Thanks so much for the 
help!

Regards,

Daniel

Warnes, Gregory R. wrote:
> You can assemble a list of colors manually to do what you want.
> Something like:
> 
> col = c("grey", "black", rainbow(50) )
> 
> ought to do the trick.
> 
> 
> -G
> 
>> Hello there! I'd just like to say in advance, "Thank you," for any
> help and/or 
>> advice.
>>
>> My problem is as follows:
>>
>> I have a dataset that is made up of percentages. I've assigned my
> "error" 
>> percentages a value of '-100', my "non-existent" percentages a value
> of '0', 
>> and all my other percentages are normal values that range from the
> high 60's to 
>> 100. I would like to create a heatmap that designates my "error"
> values as 
>> gray, my "non-existent" values as black, and I would like to to have
> the rest 
>> of my values, say 50 to 100, as a rainbow-type spectrum (like the
> palette 
>> "Spectral" in RColorBrewer, except with 50 values).
>>
>> I've tried using breaks, and then implementing the breaks in my
> heatmap.2 
>> command. The breaks work just fine. I guess what I want to control is
> the range 
>> of the:
>>
>> col=(colorpanel(#, low="color1", mid="color2", high="color3"))
>>
>> command. Is there any way to set more values than "low," "mid," and
> "high?" If 
>> that is possible I think it would solve my problem. I've looked over
> the 
>> documentation and searched over previous color/heatmap-related
> questions, but 
>> haven't come across anything that points me in the right direction.
>>
>> Please let me know if any of what I said needs clarifying before you
> can give 
>> me what you feel is an appropriate response. Thanks again for your
> time.
>> Regards,
>>
>> Daniel
>>
>> ______________________________________________
>> 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.
>>
> 
> Thomas Lumley			Assoc. Professor, Biostatistics
> tlumley at u.washington.edu	University of Washington, Seattle
> 
> ______________________________________________
> 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