Question: Good resolution Heatmap
gravatar for BAGeno
14 months ago by
BAGeno120 wrote:


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?

heatmap R • 602 views
ADD COMMENTlink modified 14 months ago by Kevin Blighe41k • written 14 months ago by BAGeno120

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.

ADD REPLYlink written 14 months ago by Jean-Karim Heriche18k

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.

ADD REPLYlink written 14 months ago by russhh4.3k
gravatar for Kevin Blighe
14 months ago by
Kevin Blighe41k
London, England
Kevin Blighe41k wrote:

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)

Increase size:

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

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.


ADD COMMENTlink modified 14 months ago • written 14 months ago by Kevin Blighe41k

Thank you so much it work :)

ADD REPLYlink written 14 months ago by BAGeno120

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

ADD REPLYlink written 14 months ago by WouterDeCoster38k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 843 users visited in the last hour