Daniel Brewer
2009-Nov-23 15:02 UTC
[R] heatmap.2 adapting the colour scale and text overlay
Hello, I am using heatmap.2 from the gplots library to plot a small symmetrical matrix. This is the command: heatmap.2(tempHeat,symm=T,trace="none",cexRow=0.7,cexCol=0.7,col="redgreen",density.info="none") I have a couple of questions: 1) The range is from -0.2 to 0.4 and the colour scheme I am using is redgreen. What I would like is that a zero value to be black, 0.4 strong green and -0.2 red. Is this possible? At the moment around 0.1 is black. 2) Is it possible to overlay text on the squares of colour? How ould one go about doing that. I am happy to use another heatmap function if ti would be better. I am not using the original heatmap as it does not provide a colour key. Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
David Winsemius
2009-Nov-23 15:38 UTC
[R] heatmap.2 adapting the colour scale and text overlay
On Nov 23, 2009, at 10:02 AM, Daniel Brewer wrote:> Hello, > > I am using heatmap.2 from the gplots library to plot a small > symmetrical matrix. > > This is the command: > > heatmap. > 2 > (tempHeat > ,symm > = > T > ,trace > ="none",cexRow=0.7,cexCol=0.7,col="redgreen",density.info="none") > > I have a couple of questions: > 1) The range is from -0.2 to 0.4 and the colour scheme I am using is > redgreen. What I would like is that a zero value to be black, 0.4 > strong green and -0.2 red. Is this possible? At the moment around > 0.1 is black.Perhaps: color.palette = colorRampPalette(c("green", "black", "pink", "red")) heatmap.2(tempHeat,symm=T,trace="none",cexRow=0.7,cexCol=0.7, col=color.palette, density.info="none")> 2) Is it possible to overlay text on the squares of colour? How > ould one go about doing that. > > I am happy to use another heatmap function if ti would be better. I > am not using the original heatmap as it does not provide a colour key. > > Thanks > > Dan > -- > ************************************************************** > Daniel Brewer, Ph.D. > > Institute of Cancer Research > Molecular Carcinogenesis > Email: daniel.brewer at icr.ac.uk > ************************************************************** > > The Institute of Cancer Research: Royal Cancer Hospital, a > charitable Company Limited by Guarantee, Registered in England under > Company No. 534147 with its Registered Office at 123 Old Brompton > Road, London SW7 3RP. > > This e-mail message is confidential and for use by the a...{{dropped: > 2}} > > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT