if (FALSE) {
library(dendextend)
set.seed(23235)
ss <- sample(1:150, 10)
# Getting the dend dend
dend <- iris[ss, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram()
dend %>% plot()
# define a list of nodes
L <- list(c("109", "123", "126", "145"), "29", c("59", "67", "97"))
dend %>%
branches_attr_by_lists(L) %>%
plot()
# choose different color, and also change lwd and lty
dend %>%
branches_attr_by_lists(L, TF_value = "blue") %>%
branches_attr_by_lists(L, attr = "lwd", TF_value = 4) %>%
branches_attr_by_lists(L, attr = "lty", TF_value = 3) %>%
plot()
}
Run the code above in your browser using DataLab