The ggdendro package offers a handy ggdendrogram() function for plotting the results of hierarchical cluster analysis. The appearance of the dendrogram generated by said function can be modified by tweaking several parameters of a ggplot object, but I have not been able to change either the line width and/or the colour of the dendrogram branches.
This is my test code (I am taking means just so simply the dendrogram for this question):
library(ggplot2)
iris <- datasets::iris
means <- aggregate(iris, by = list(iris$Species), FUN = mean)
d <- dist(means)
hc <- hclust(d, method = "average")
dd <- ggdendrogram(hc) + theme_minimal() +
labs(x = "Species",
y = "Euclidean distance") +
coord_flip() +
theme(panel.grid.major.y = element_blank(),
panel.grid.minor.y = element_blank())
plot(dd)
What I need is probably something like this: Increase the size of line in geom_line, but I would like a simple solution without requiring tidyverse trickery!
Thanks in advance!