a<-matrix(rnorm(36,1,3),6,6)
ifelse(a<(-1),1,ifelse(a<=1&a>=-1,2,3))
heatmap.2(a, col=rev(redgreen(3)))
HTH
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Daren Tan
Sent: January 6, 2009 11:53 PM
To: r-help at r-project.org
Subject: [R] heatmap.2 and three colours for specific ranges?
Hi,
I hope to show a heatmap with thre colours, no gradation. How to specify
heatmap.2 to map "green" for values less than -1, "gray" for
values between
-1 and 1, and "red" for values greater than 1 ?
Thanks
[[alternative HTML version deleted]]
______________________________________________
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.