| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/ggdendrogram.R |
| 3 |
\name{ggdendrogram} |
| 4 |
\alias{ggdendrogram} |
| 5 |
\title{Creates dendrogram plot using ggplot.} |
| 6 |
\usage{ |
| 7 |
ggdendrogram( |
| 8 |
data, |
| 9 |
segments = TRUE, |
| 10 |
labels = TRUE, |
| 11 |
leaf_labels = TRUE, |
| 12 |
rotate = FALSE, |
| 13 |
theme_dendro = TRUE, |
| 14 |
... |
| 15 |
) |
| 16 |
} |
| 17 |
\arguments{ |
| 18 |
\item{data}{Either a dendro object or an object that can be coerced to class |
| 19 |
dendro using the \code{\link[=dendro_data]{dendro_data()}} function, i.e. objects of class |
| 20 |
dendrogram, hclust or tree} |
| 21 |
|
| 22 |
\item{segments}{If TRUE, show line segments} |
| 23 |
|
| 24 |
\item{labels}{if TRUE, shows segment labels} |
| 25 |
|
| 26 |
\item{leaf_labels}{if TRUE, shows leaf labels} |
| 27 |
|
| 28 |
\item{rotate}{if TRUE, rotates plot by 90 degrees} |
| 29 |
|
| 30 |
\item{theme_dendro}{if TRUE, applies a blank theme to plot (see |
| 31 |
\code{\link[=theme_dendro]{theme_dendro()}})} |
| 32 |
|
| 33 |
\item{...}{other parameters passed to \code{\link[ggplot2:geom_text]{ggplot2::geom_text()}}} |
| 34 |
} |
| 35 |
\value{ |
| 36 |
A \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} object |
| 37 |
} |
| 38 |
\description{ |
| 39 |
This is a convenience function |
| 40 |
} |
| 41 |
\examples{ |
| 42 |
### Demonstrate ggdendrogram |
| 43 |
|
| 44 |
library(ggplot2) |
| 45 |
hc <- hclust(dist(USArrests), "ave") |
| 46 |
|
| 47 |
# Demonstrate plotting directly from object class hclust |
| 48 |
p <- ggdendrogram(hc, rotate = FALSE) |
| 49 |
print(p) |
| 50 |
ggdendrogram(hc, rotate = TRUE) |
| 51 |
|
| 52 |
# demonstrate converting hclust to dendro using dendro_data first |
| 53 |
hcdata <- dendro_data(hc) |
| 54 |
ggdendrogram(hcdata, rotate = TRUE, size = 2) + |
| 55 |
labs(title = "Dendrogram in ggplot2") |
| 56 |
} |
| 57 |
\seealso{ |
| 58 |
\code{\link[=dendro_data]{dendro_data()}} |
| 59 |
} |