ColorDendrogram {PoiClaClu} | R Documentation |
Color the leaves in a hierarchical clustering dendrogram
Description
Pass in the output of "hclust" and a class label for each observation. A colored dendrogram will result, with the leaf colors indicating the classes.
Usage
ColorDendrogram(hc, y, main = "", branchlength = 0.7, labels = NULL,
xlab = NULL, sub = NULL, ylab = "", cex.main = NULL)
Arguments
hc |
The output of running "hclust" on a nxn dissimilarity matrix |
y |
A vector of n class labels for the observations that were clustered using "hclust". If labels are numeric from 1 to K, then colors will be determine automatically. Otherwise the labels can take the form of colors (e.g. c("red", "red", "orange", "orange")). |
main |
The main title for the dendrogram. |
branchlength |
How long to make the colored part of the branches. Adjustment will be needed for each dissimilarity matrix |
labels |
The labels for the n observations. |
xlab |
X-axis label. |
sub |
Sub-x-axis label. |
ylab |
Y-axis label. |
cex.main |
The amount by which to enlarge the main title for the figure. |
Author(s)
Daniela Witten
Examples
set.seed(1)
dat <- CountDataSet(n=20,p=100,sdsignal=2,K=4,param=10)
dd <- PoissonDistance(dat$x,type="mle")
ColorDendrogram(hclust(dd$dd), y=dat$y, branchlength=10)