Thanks Tom.

heatmap.2(mat, Rowv=NA, Colv=NA, col=redgreen, breaks=seq(-1,1,by=0.01), symm=TRUE, trace="none", dendrogram="none")

that did the trick :)



Begin forwarded message:

From: "Leja, Thomas"
Date: 29 March 2011 03:47:59 GMT+01:00
To: "Benton, Paul"
Subject: Re: [R] comparing heatmaps

Yep, you have to specify the range for colours.

I usually plot the correlations from 0 to 1. Just add "breaks" option and colour without the gradient:
col=redgreen, breaks=seq(0,1,by=0.1),

Hope this helps :)

Best,

Thomas

From: "Benton, Paul"
Date: 29 March 2011 02:36:02 GMT+01:00
To: "<mailto:R-help@r-project.org>R-help@r-project.org<mailto:R-help@r-project.org>" <<mailto:R-help@r-project.org>R-help@r-project.org<mailto:R-help@r-project.org>>
Subject: Re: [R] comparing heatmaps

Benno,

That helps but it only makes the color bar symmetrical. I want to be able to compare 2 different heatmaps so that 0.7 (for example) is always the same tone of green and not shifted slightly. Is this possible?

Paul

On 28 Mar 2011, at 10:42, Benno Pütz wrote:


On 27.Mrz.2011, at 22:54, Benton, Paul wrote:

library(gplots)
dat<-cor(matrix(rnorm(100, m=10), nrow=10))
mat<-cor(matrix(rnorm(100), nrow=10))
dev.new()
heatmap.2(mat, Rowv=NA, Colv=NA, col=redgreen(75), symm=TRUE, trace="none", dendrogram="none",
main = paste("Correlation Matrix for time delay at ", sep=""))
dev.new()
heatmap.2(dat, Rowv=NA, Colv=NA, col=redgreen(75), symm=TRUE, trace="none", dendrogram="none",
main = paste("Correlation Matrix for time delay at ", sep=""))
In this case adding

symkey = TRUE

to the heatmap.2 calls should help

Benno




	[[alternative HTML version deleted]]

