Increasing row height in R heatmap() function

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:51:39

A while ago, I also faced the same problem. heatmap.2 function from gplots package solved the problem. However, I don't quite see how looking at so many genes (or rowlabs) is beneficial. But as you asked you would do something like this: The key is change the layout (see ?heatmap.2, ?layout) of the heatmap which draws heatmap on a 2x2 grid on the plotting device (the example in ?layout explains this much better). After that, you may want to change the cex of rowlabs by changing cexRow accordingly. Your situation might need a bit of playing around with the values to get the desired result.

library(gplots)

row.scaled.expr <- matrix(sample(1:10000),nrow=1000,ncol=10)

png( 'heatmap_without_whitespace_smaller_row_lab.png', width=500, height=1500)
heatmap.2(row.scaled.expr, dendrogram ='row',
                 Colv=FALSE, col=greenred(800), 
                 key=FALSE, keysize=1.0, symkey=FALSE, density.info='none',
                 trace='none', colsep=1:10,
                 sepcolor='white', sepwidth=0.05,
                 scale="none",cexRow=0.2,cexCol=2,
                 labCol = colnames(row.scaled.expr),                 
                 hclustfun=function(c){hclust(c, method='mcquitty')},
                 lmat=rbind( c(0, 3), c(2,1), c(0,4) ), lhei=c(0.25, 4, 0.25 ),                 
                 )
dev.off()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!