colorDendro | R Documentation |
Assign colors to the labels of a hclust
dendrogram according to a factor
colorDendro(hclust, labels = hclust$labels, lab.col = NULL, ...)
hclust |
a |
labels |
a character vector of labels for the leaves of the tree. By default, the labels in the |
lab.col |
a color vector for the labels. |
... |
further arguments passed to plot function |
a dendrogram
Mélanie Huchon
#Load data example
data(iris)
#Run hclust on this data
hc <- hclust(dist(iris[, -5]))
#Color vector
color <- c("#440154FF", "#21908CFF", "#FDE725FF")
#Use function to color labels
colorDendro(hc, labels = iris[,5], lab.col = color, main = "Dendrogram of Iris data")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.