Dear R users,

I'm trying to create images of 2 symmetrical matrices using heatmap.2 of the 
'gplots' library. Both matrices have the same row and column names
For the first matrix I'm using the default clustering and column denrogram 
options: 
heatmap.2(Matrix1, symm=T, breaks=20, col=rich.colors(19), main="matrix1", 
density.info="histogram", denscol="black", trace="none", na.rm=T, 
dendrogram="col", Colv=T)

I would like to show the second matrix with the same row and column ordering of 
the first matrix.
I've tried using the following to create dendrogram objects of the first matrix:

z=heatmap(Matrix1, keep.dendro = T, symm=T, 
breaks=seq(min(Matrix1),max(Matrix1),len=20), col=rich.colors(19), na.rm=T)

z$Rowv, z$Colv are now dendrograms of the rows and the columns repectively 
(this couldn't be done with heatmap.2 since it doesn't return the dendrogram 
objects).

and I've tried to create the wanted image using:
heatmap.2(Matrix2, symm=T, breaks=20, col=rich.colors(19), main="Matrix2", 
density.info="histogram", denscol="black", Colv=z$Colv, Rowv=z$Rowv, 
trace="none", na.rm=T, keysize=1.5, dendrogram="none")

The problem is that I get the column and row lables in the wanted order but 
they are not related to the columns and the rows in the image (meaning that the 
labels are wrong col1 is labeled as col4 etc.)

I've tried the following solution :
heatmap.2(Matrix2, symm=T, breaks=20, col=rich.colors(19), main="Matrix2", 
density.info="histogram", denscol="black", Colv=z$Colv, Rowv=z$Rowv, 
trace="none", na.rm=T, keysize=1.5, dendrogram="none",labRow=labels(z$Rowv), 
labCol=labels(z$Colv))

But I still get the same problem of mismatch between labels and columns/rows as 
well as loosing the wanted order of labels in the image.

I would appreciate any suggestions and help

Shany
        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to