[R] easier way to print heatmap on multiple pages?
1
0
Entering edit mode
Yannick Wurm ▴ 220
@yannick-wurm-2314
Last seen 10.2 years ago
Hi, quick reply to a post thats a few years old since I just struggled with the same issue: to split a single heatmap with too many lines onto multiple pages (ie keeping text size readable), I ended up using the following trick: 1. create a huge pdf. eg one that is 8 pages tall: > pagesToOutputOn = 8 > pdf(outputPath, paper="special", pointsize=10, width=29.7/2.54, height=20.9/2.54 * pagesToOutputOn, pagecentre=FALSE) # do your heatmap > dev.off() 2. Use Tiler on the mac (I'm sure other tools exist), to cut your single big pdf into several pages http://www.mindcad.com/tiler.html Cheers, Yannick Jake Michaelson jjmichael <at> comcast.net writes: > 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
• 2.7k views
ADD COMMENT
0
Entering edit mode
Julian Lee ▴ 140
@julian-lee-2487
Last seen 10.2 years ago
Alternatively, you can output your heatmaps using the library, 'ctc'. Use TreeView or JavaTreeView to view those heatmaps. I find them more useful and easier than chopping up the PDFs. hope that helps. regards julian ----- Original Message ----- From: "Yannick Wurm" <yannick.wurm@unil.ch> To: bioconductor at stat.math.ethz.ch Cc: jjmichael at comcat.net Sent: Thursday, April 2, 2009 6:28:01 PM GMT +08:00 Beijing / Chongqing / Hong Kong / Urumqi Subject: Re: [BioC] [R] easier way to print heatmap on multiple pages? Hi, quick reply to a post thats a few years old since I just struggled with the same issue: to split a single heatmap with too many lines onto multiple pages (ie keeping text size readable), I ended up using the following trick: 1. create a huge pdf. eg one that is 8 pages tall: > pagesToOutputOn = 8 > pdf(outputPath, paper="special", pointsize=10, width=29.7/2.54, height=20.9/2.54 * pagesToOutputOn, pagecentre=FALSE) # do your heatmap > dev.off() 2. Use Tiler on the mac (I'm sure other tools exist), to cut your single big pdf into several pages http://www.mindcad.com/tiler.html Cheers, Yannick Jake Michaelson jjmichael <at> comcast.net writes: > 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 _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Julian Lee Bioinformatics Specialist Cellular and Molecular Research National Cancer Center Singapore
ADD COMMENT

Login before adding your answer.

Traffic: 485 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6