This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Good resolution Heatmap

Hi

I am trying to create heatmaps. I have used heatmap.2, pheatmap and clustvis. I have dataset of 2000 rows containing allele frquency of different SNPs in different populations. I cannot filter rows as I am visualizing relationship between different populations on the basis of allele frequencies. The problems with R packages is that they does not create good resolution heatmaps. And clustvis plots heatmaps on the basis of principal components not on the basis of actual allele freqiencies.

Can anyone please tell me how to great good resolution heatmaps of such large datasets?

r heatmap

you could run k-means and then create k different heatmaps, one for each cluster. I don't think you'll get over the poor resolution with so many datapoints. For interactive work you could generate a zoomable heatmap in an app.

What do you mean by good resolution ? Typically, plotting a large data set such that all details are visible to the naked eye means making the plot bigger. If you want labels to be readable they should be in a font at least 7-8 pt (~10 pixels) which means this is also the minimum height of a heatmap cell so 2000 rows x 10 = 20000 pixels so for a typical printer resolution of 72 dpi, that's a paper height of 278 inches or about 7 meters. Which is why dimensionality reduction techniques are useful for visualization. Clustering is one possible approach but you may also not have to use heatmaps depending on what you're trying to show.

1 answer

The resolution or overall sense of 'quality' of a figure is determined by a few different factors, including (but not limited to):

  • your monitor's type and capabilities (LED, etc)
  • the screen resolution you have set via your operating system
  • the compression format (or not) in which you're encoding your figure (PNG, TIFF, PDF, etc)
  • how much information you are attempting to 'pack' into the figure

Problems with heatmaps in R are usually related to too much information being 'packed' into too small a space.

The first thing that you should do is save your figure in a vector-based format, such as PDF, and then you can manage the 'packing' of information into this by altering the width and height, for example:

pdf("Test.pdf", width=7, height=7)
...
dev.off()

Increase size:

pdf("Test.pdf", width=12, height=18)
...
dev.off()

width and height here relate to inches.

With other formats, like TIFF, PNG, et cetera, width and height relate to pixels, but the resolution will never have the clarity as in vector-based formats.

Kevin

Thank you so much it work :)

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted. Upvote|Bookmark|Accept

Log in to answer this question.