colorDendro: Color the dendrogram labels

View source: R/colorDendro.R

colorDendroR Documentation

Color the dendrogram labels

Description

Assign colors to the labels of a hclust dendrogram according to a factor

Usage

colorDendro(hclust, labels = hclust$labels, lab.col = NULL, ...)

Arguments

hclust

a hclust object.

labels

a character vector of labels for the leaves of the tree. By default, the labels in the hclust object are used if specified.

lab.col

a color vector for the labels.

...

further arguments passed to plot function

Value

a dendrogram

Author(s)

Mélanie Huchon

Examples

#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")

sistm/sistmr documentation built on March 8, 2024, 3:05 a.m.