plt_dend | R Documentation |
Visualize hierarchical clustered object with different colored clusters and leaf labels.
plt_dend(
hc,
n_clusters,
label_size = 0.8,
title = "Hiearchical Clustering Result",
subtitle = NULL,
xlab = NULL,
ylab = NULL
)
hc |
Object returned by 'hclust()'. |
n_clusters |
Integer. Number of clusters. |
label_size |
Numeric. Size (default = 0.8) of text labels for the leaves. |
title |
String. Plot title (default = "Hiearchical Clustering Result"). |
subtitle |
String. Plot subtitle (default = NULL). |
xlab |
String. Label of the x-axis (default = NULL). |
ylab |
String. Label of the y-axis (default = NULL). |
A ggplot2 dendrogram.
data(USArrests)
dd = dist(scale(USArrests), method = "euclidean")
hc = hclust(dd, method = "ward.D2")
plt_dend(hc, 2)
plt_dend(hc, 4, label_size = 0.5)
plt_dend(hc, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.