heatmap2 lmat,lhei, lwid parameters?

Viewed 7623

I'm trying to make a heat map with dendrogram in R. I'm also trying to make it so that the color matrix is on the bottom of the heat map. i understand that I would have to change the value of lmat for this. So far I have something like this for lmat.

 lmat=rbind(c(0,3,0), c(2,1,0), c(0,4,0)).

After I run it, it asks me to update the lhei and lwid values. After looking at the documentation, I understand that these are vectors for column width and row height. But I don't understand the multiple values needed for their values. For ex, when I set this , I get this error.

  lhei must have length = nrow(lmat) = 3

I'm not sure what the three values for lhei would correspond to. This leads me to a broader question, what does each value in the vectors for lhei and lwid correspond to?

2 Answers

lmat stands for layout matrix, and in heatmap.2 the default is a 2x2 matrix used to organize four components (1=heatmap, 2=row dendogram, 3=col dendogram, 4= key ) as follows: lmat = rbind(c(4,3),c(2,1)) Your error, "lhei must have length = nrow(lmat) = 3" arises because you need to specify the new lhei or layout row heights, which from your code is now 3 rows. Visually it helps to organize this code in stacked format. In your example I can clearly see that the key will be below the heatmap, while the zeros are used as padding.

Related