Colouring branches in a dendrogram in R
Dear resident R geniuses, I would like to colour the branches of cluster in a dendrogram where the leaves are not labelled. I found the following script here on Stackoverflow: clusDendro <- as.dendrogram(Clustering) labelColors <- c("red", "blue", "darkgreen", "darkgrey", "purple") ## function to get colorlabels colLab <- function(n) { if(is.leaf(n)) { a <- attributes(n) # clusMember - a vector designating leaf grouping # labelColors - a vector of colors for the above grouping labCol <- labelColors[clusMember[which(names(clusMember) == a$label)]] attr(n, "nodePar") <- c(a$nodePar, lab.col =