1

I used the R code below to obtain a heatmap of some data;the heatmap displays a dendrogram at the top of the columns, but I would rather have the dendrogram to be shorter in length, so as to have enough space left at the bottom of the heatmap for some long column labels. Is there any way to tweak the lengths of dendrograms?

<- heatmap.2(t(mully), scale="none", Rowv=F,
   col = myCol, 
   breaks = myBreaks, 
   dendrogram="row",  
   margins=c(0.55,8.4), cexRow=0.68, cexCol=0.9, key=FALSE,
   labCol =NULL,
   trace="none")

I would be happy to get some help.

James

James Johnson
  • 117
  • 2
  • 2
  • 7
  • 2
    You would be happy to get some help and we would be happy to have some data to work with. See: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – IRTFM Aug 13 '12 at 03:21

1 Answers1

2

You can try pheatmap package for drawing the heatmap.

    pheatmap(t(mully), colors = myCol, breaks = myBreaks)        

If the matrix is too big to fit properly into the plotting window, then you can fix cell heights and widths and write the result into a file. This ensures that all the relevant parts of the plot will be visible.

    pheatmap(t(mully), colors = myCol, breaks = myBreaks, cellheight = 10, 
    cellwidth = 10, filename = "example.png")        
Raivo Kolde
  • 729
  • 6
  • 14
  • Thank you very much, Raivo. The pheatmap worked beautifully! I really appreciate your help. For some reason, my first attempt only game me a heatmap with only blue color; then I changed the "color = mycol" to "col = mycol" and I was able to see all my five defined colors. I don't know why it worked. Anyway, my problem is now solved. Many thanks! – James Johnson Aug 15 '12 at 04:15