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

Thomas Lumley tlumley at u.washington.edu
Thu Aug 7 05:37:32 CEST 2008


colorRampPalette() may do what you want.

        -thomas


On Wed, 6 Aug 2008, Daniel Bernstein wrote:

> 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



More information about the R-help mailing list