Increase the size of legend in pheatmap
1
2
Entering edit mode
6.3 years ago
biologo ▴ 40

Hi,

I was using the pheatmap to cluster all the samples and do the visualization, but i was confused that how to increase the size legend which shows like that.

Thank you so much.

Snipaste 2018 08 03 15 39 23

RNA-Seq heatmap R • 28k views
ADD COMMENT
0
Entering edit mode

try increasing plot area. For any such questions, posting example data and code will help people to understand issue and post answer @ biologo

ADD REPLY
0
Entering edit mode

To continue with @cpad0112's answer, you can try;

pheatmap(, cellwidth=x, cellheight=y)

where x and y values you can play around to find the best size.

ADD REPLY
0
Entering edit mode

THKs,i tried it, but seems doesn't work

ADD REPLY
0
Entering edit mode

sorry, it;s my fault. i try many ways to increase the size of legend(not the label), but all faild. the code like:

pheatmap(data,
         method = c("pearson"),
         clustering_method = "complete",
         cellwidth = 80, 
         cellheight = 80,
         treeheight_row = 400,
         treeheight_col = 400,
         cluster_row = T,
         cluster_col = T,
         show_rownames = T,
         show_colnames = T,
         cex = 2.5,
         legend = T,
         fontsize = 10,
         legend_breaks = 0:1,
         color = colorRampPalette(brewer.pal(9,"Reds"))(400),
         border_color = "NA")
ADD REPLY
2
Entering edit mode
6.3 years ago

Take a back up of your code posted above, and try plotting with this basic code (OP code). If you can see the legend, then keep optimizing heatmap. I think unoptimized cell and other parameters are issue here in code (as data is not furnished) :

pheatmap(data,
         method = c("pearson"),
         clustering_method = "complete",
         treeheight_row = 40,
         treeheight_col = 40,
         cluster_row = T,
         cluster_col = T,
         show_rownames = T,
         show_colnames = T,
         legend = T,
         fontsize = 10,
         color = colorRampPalette(brewer.pal(9,"Reds"))(400))
ADD COMMENT
0
Entering edit mode

thank you very much, it works well now

ADD REPLY

Login before adding your answer.

Traffic: 1972 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