[R] easier way to print heatmap on multiple pages?

From: Jake Michaelson <jjmichael_at_comcast.net>
Date: Fri 12 Aug 2005 - 03:56:55 EST


Hi All,

I've worked on some code to take a heatmap with 1000 row entries, and split this up into 20 pages, each with 50 rows from the original heatmap. I want to preserve the row order such that all 20 pages, if put together, would comprise the original heatmap.

Here's what I've done:

##make the initial heatmap, with all 1000 rows and write it to an object 'heatAll'
heatAll = heatmap.2(combined.int.top, col = cm.colors(256), trace = "none")

  pdf(file="~/Desktop/Alfalfa-Ladak-StemV3.pdf", width=8, height=12, pointsize=4)
for(i in 1:20){

   selected = heatAll$rowInd[((i-1)*50):((i-1)*50+50)] ##get original row order in groups of 50

   heatmap.2(combined.int.top[selected,], Rowv = FALSE, ##prevent row re-ordering

   Colv=heatAll$colInd,
   col=cm.colors(256),
   trace="none", margins = c(9,8),
   main=paste("page", i, sep=" "))

  }
  dev.off()

I can't think of why this wouldn't work, but for some reason things are completely out of order. For example, the first page of the PDF shows many genes found at the bottom of the original heatmap, but in a different order. Strange.

So, have I made this insanely complicated? Is there an easier, better way to print a large heatmap on multiple pages?

Thanks in advance for any help.

--Jake



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 12 04:01:49 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:15:06 EST