2
$\begingroup$

I have plotted a heat-map with 235 rows and 570 columns which is below: how do we make clear names of row and columns on this graph using R?

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Please show the command you used to create that heatmap. Answers will differ depending on what library / function you're using. $\endgroup$
    – gringer
    Commented Jan 1, 2023 at 21:29

2 Answers 2

4
$\begingroup$

You don't, simple as that, it is too many in both columns and rows to show them all. You could shrink size, but then it becomes unreadable. You can highlight individual genes (rows) that are important to support the message you want to send with that experiment, with packages such as ComplexHeatmap, see the Mark annotation section.

Alternatively, you can use something like hierarchical clustering to form groups, then make functional annotations (such as REACTOME terms) and then annotate eaqch cluster with selected terms, again to support the message you want to send. Go through the ComplexHeatmap manual, lots of examples with code there to get inspiration from.

As for the columns, you could use block annotations to color-highlight columns bhelonging to the same experimental group, or split the heatmap by these groups to put some visual separation/guidance.

$\endgroup$
1
  • $\begingroup$ Thank you @ATpoint $\endgroup$ Commented Dec 31, 2022 at 16:59
2
$\begingroup$

[note: This is a generic answer; the post was not specific enough for me to be able to include any more useful detail]

A heatmap of 235 rows and 570 columns is within the realm of what should be explorable / visible with a bit of tweaking. I have needed to do this with large heatmap plots - for example, single cell data with 500 genes and 2000 cells, where I care about the genes but not the cell IDs. My usual approach is to make the dimensions of the output image larger, and also reduce the text size.

The method of doing that depends a lot on how the plot was generated initially. For example, if using a base R package:

pdf("output_file_name.pdf", width=57, height=23.5); # about 10 squares per inch
## <plot generation function>
dev.off()

If using ggplot:

library(tidyverse);
input_data %>%
  ggplot() +
  aes(...) +
  # <plot generation function>
ggsave("output_file_name.pdf", width=57, height=23.5);

Changing the function used to display the heatmap can sometimes help as well (e.g. pheatmap instead of heatmap).

Within the functions, text size can often be reduced to help with this as well (e.g. cex = 0.2). There is a limit to how much this can be done, as most PDF viewing programs have a zoom limit - I think Adobe Reader's limit is 6400% (i.e. 64 times magnification) - as well as maximum page dimension limits.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you @gringer♦ $\endgroup$ Commented Jan 7, 2023 at 6:44
  • 1
    $\begingroup$ This was useful, gringer. $\endgroup$ Commented Apr 3, 2023 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.