[R] heatmap.2 color range

evgeny55 evgeny55 at yahoo.com
Tue Jan 26 16:27:35 CET 2010


Hi,
I'm trying to create a heatmap with color ranges for different values in my
matrix. For example:
If  x > 5 , use orange gradient
if  x < 1.5, use red gradient
.....

Right now I have the following:
orgPal<-brewer.pal(3,"Oranges")
bluPal<-brewer.pal(3,"Blues")
redPal<-brewer.pal(3,"Reds")

grad <- ifelse(randMat > 5,orgPal,ifelse(randMat<1.5,redPal,bluPal))
hmap <- heatmap(randMat,Rowv=NULL, Colv=NULL,dendrogram="none",col = grad,
scale="column",...)

the problem is that all the colors become very close to white on one end of
the spectrum and the orange colors, for example, start approaching red when
x reaches extreme values and the heatmap loses its effect.  Is there an easy
way to specify a start and end range for each of my colors so that the hue
does not change dramatically within each spectrum.  I'm sure that I can
explicitly specify all the colors within my ifelse statement but this is
rather time consuming.

thanks,
John
-- 
View this message in context: http://n4.nabble.com/heatmap-2-color-range-tp1293498p1293498.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list