I am trying to modify and tweak cluster dendrogram using dendextend, using below codes:
# prepare hierarchical cluster
hc = hclust(dist(mtcars))
dend <- as.dendrogram(hc)
dend %>% set("branches_lty", 3) %>% plot()
Please how can i set branches_lty for a specific K cluster?
Also, i want to modify and align the leave text to a give length and indent as shown in the picture.
I attach an example picture to see, i can’t achieve it with dendextend package.
NB:
I can plot it using A2Rplot, but i cant modify it. is it possible to use both?
# load code of A2R function
source("http://addictedtor.free.fr/packages/A2R/lastVersion/R/code.R")
# colored dendrogram
op = par(bg = "#EFEFEF")
A2Rplot(hc, k = 3, boxes = FALSE, col.up = "gray50", col.down = c("#FF6B6B", "#4ECDC4", "#556270"))