pheatmap lengends are being cutoff
2
0
Entering edit mode
3.1 years ago
enh • 0

I'm trying to removed annotations for the heat map legend. Originally this what the heatmap looks like using the following code:
pheatmap(M.adj, annotation_col = conds, #dropData set border_color = NA, filename = "QC/QCheatmap.pdf", color = colorRampPalette(rev(brewer.pal(n=11, name="RdBu")))(100), cluster_cols = TRUE, show_rownames = FALSE, main=paste("Gene Expression (VST) of Top 1000 Variable Genes") )

heat map1

when I drop my "dataset" colm using the following piece of code, my legends is cutoff.

pheatmap(M.adj, annotation_col = conds[2,drop=F], #dropData set border_color = NA, filename = "QC/QCheatmap.pdf", color = colorRampPalette(rev(brewer.pal(n=11, name="RdBu")))(100), cluster_cols = TRUE, show_rownames = FALSE, main=paste("Gene Expression (VST) of Top 1000 Variable Genes") )

heatmap 2

anyone know how I can make it so that my legend is not cut off in the second heat map?

pheatmap legends rstudio heatmaps • 4.7k views
ADD COMMENT
0
Entering edit mode
3.1 years ago

Hi!

You can scale the plotting text with cex. In this case the default value is cex = 1, 1.5 would correspond to 50% larger and 0.5 50% smaller. So, use different values less than 1 until you see the whole text legend.

Best regards

ADD COMMENT
0
Entering edit mode

Hi rodolfo! Thank you!! I'll try what you suggested. I got around it by making the naming conventions of my conditions shorter. I'll try what you suggested and to see if I can keep the length of my conditions.

Thank you for you time:)

ADD REPLY
0
Entering edit mode
4 months ago
Chris S. ▴ 320

Save the pheatmap output and then change the viewport using gridExtra.

p <- pheatmap(M.adj, ..)
gridExtra::grid.arrange(p$gtable, vp=viewport(width=0.9, height=1))
ADD COMMENT

Login before adding your answer.

Traffic: 1465 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6