ggdendrogram | R Documentation |
This is a convenience function
ggdendrogram(
data,
segments = TRUE,
labels = TRUE,
leaf_labels = TRUE,
rotate = FALSE,
theme_dendro = TRUE,
...
)
data |
Either a dendro object or an object that can be coerced to class
dendro using the |
segments |
If TRUE, show line segments |
labels |
if TRUE, shows segment labels |
leaf_labels |
if TRUE, shows leaf labels |
rotate |
if TRUE, rotates plot by 90 degrees |
theme_dendro |
if TRUE, applies a blank theme to plot (see
|
... |
other parameters passed to |
A ggplot2::ggplot()
object
dendro_data()
### Demonstrate ggdendrogram
library(ggplot2)
hc <- hclust(dist(USArrests), "ave")
# Demonstrate plotting directly from object class hclust
p <- ggdendrogram(hc, rotate = FALSE)
print(p)
ggdendrogram(hc, rotate = TRUE)
# demonstrate converting hclust to dendro using dendro_data first
hcdata <- dendro_data(hc)
ggdendrogram(hcdata, rotate = TRUE, size = 2) +
labs(title = "Dendrogram in ggplot2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.