0

I generated a heatmap of some single cell data (3285 cells x 6000 genes) using the pheatmap package on Rstudio. The columns are different individual cells, and the rows are different genes. I was able to find a pattern looking at the heatmap, and now I want to take a closer look at those sections. Is there anyway I could zoom in onto the regions of the heatmap squared in yellow other than just zooming in on the picture?

heatmap

Thank you so much!

benson23
  • 16,369
  • 9
  • 19
  • 38
  • There's not really a way to "zoom" in with the built in plot viewer. If you want to see a smaller region in more detail, you should just filter your data before plotting. – MrFlick Feb 16 '22 at 05:35
  • As @MrFlick said - you can't really zoom directly. Instead you can subest and replot. Because these are clustered heatmaps, those boxes are usually sub-trees of the dendrogram. Therefore, you can often use something like `stats::cutree()` to find those clusters in your data and then replot. – Dan Adams Feb 16 '22 at 13:52

1 Answers1

0

You can either:

  • dplyr::select() or dplyr::filter() the columns or rows that correspond to the parts you want to view and redraw the plot
  • save the image as a vector image (e.g. .svg (the one I use), .eps, etc.) with ggsave() and then zoom-in at the saved image. Note that vector images such as .svg and .eps do not fragment into pixels.
  • use completely different package that enables you to interact with the resultant output image, such as library(heatmaply)