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
Asked
Active
Viewed 1,578 times
1

Joe
- 8,073
- 1
- 52
- 58

The August
- 469
- 2
- 7
- 18
-
The line `ph$gtable$grobs[[1]]$gp <- gpar(lwd = 5)` sets the line width. It made the lines wide for me. – G5W Sep 21 '19 at 00:28
-
Thanks , but I'm looking for similar functionality in heatmap.2 function and NOT in pheatmap – The August Sep 22 '19 at 14:35
1 Answers
0
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.

Joe
- 8,073
- 1
- 52
- 58