简体   繁体   中英

Changing line width of dendrogram in heatmap.2

I'm trying to plot a heatmap using gplots::heatmap.2() .There are a lot of rows and the dendrogram lines appear to be quite thin compared to the image. I 'm wondering if there is any technique to thicken the dendrogram lines as mentioned in this post for the pheatmap output. Thanks

Yes, the dendextend package does this easily. We can use its set() function here to achieve the desired effect.

set.seed(123)
dat <- matrix(rnorm(100), nrow = 10)

library(gplots)
library(dendextend)

dd <- set(as.dendrogram(hclust(dist(dat))), "branches_lwd", 3)

heatmap.2(dat, Rowv = dd, Colv = dd)

在此处输入图像描述

It's worth looking into all the other cool stuff Dendextend does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM