[R] Howto fix colors in colorRampPalette?

From: Ashoka Polpitiya <ashoka.pol_at_gmail.com>
Date: Mon, 25 Jun 2007 21:55:18 -0700


Hi All,

I am plotting a correlation matrix using the heatmap function. I create my color palette as follows (say, for red-green palette): colorRampPalette( c("green", "black", "red"), space="rgb")(10)

But I want to fix colors for a specific range of values, i.e. green=-1, black=0, red=+1. The purpose of doing this is I can then quickly compare two different correlation matrices visually, i.e., one matrix has values in the range -1 to +1, whereas the other has from -0.5 to +0.5. Then the two heatmaps differ in color levels. I searched in the help archives to find any hints but didn't. Is there an easy way of doing this? Any help is greatly appreciated.

Thanks.
Ashoka.

        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch 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. Received on Tue 26 Jun 2007 - 04:58:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Jun 2007 - 05:32:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.