This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Plot A 'Longer' Heatmap Using R?

Hi, I try to plot a heatmap for 200*40 matrix. But the heatmap function output a figure without clear row label, and the outline of the figure likes square. I try to plot a longer figure perhaps to solve this problem, but I don't know how to do this work.
Anyone can tell me? Thank you.

r heatmap

Please post the code you're using to make your heatmap.

3 answers

While I disagree that a longer plot will be any clearer; I can answer your technical question.

(in R) The size of the plot is scaled to the "output device" which you can specify by wrapping the plotting code in two new statements.

pdf("filename.pdf",width=24,height=8)
#heatmap()
dev.off()

That will make a 24" wide, 8" tall file that should look nice. Depending on your environment those might be specified as centimeters or inches. Another good one is

png("filename.png",width=2000,height=800)
#heatmap()
dev.off()

That will make a 2000x800 pixel bitmap image.

That partly solves my problems, thank you.

(+1) Nice alternatives!

I appreciate that this has been a long time since your question, and may not directly answer your question. But I just developed a Julia-based GUI tool to plot heatmaps based on Python's Seaborn package, just wanted to share it here. Very minimal/no coding is required for this. This is the link:

https://github.com/srgk26/easy_plotting.app

Log in to answer this question.