View source: R/craft-align-dendrogram.R
| align_dendro | R Documentation |
Plot dendrogram tree
align_dendro(
mapping = aes(),
...,
distance = "euclidean",
method = "complete",
use_missing = "pairwise.complete.obs",
reorder_dendrogram = FALSE,
merge_dendrogram = FALSE,
reorder_group = FALSE,
k = NULL,
h = NULL,
cutree = NULL,
plot_dendrogram = TRUE,
plot_cut_height = NULL,
center = FALSE,
type = "rectangle",
root = NULL,
size = NULL,
data = NULL,
active = NULL,
no_axes = deprecated()
)
mapping |
Default list of aesthetic mappings to use for plot. If not specified, must be supplied in each layer added to the plot. |
... |
<dyn-dots> Additional arguments passed to
|
distance |
A string of distance measure to be used. This must be one of
|
method |
A string of the agglomeration method to be used. This should be
(an unambiguous abbreviation of) one of |
use_missing |
An optional character string giving a method for computing
covariances in the presence of missing values. This must be (an abbreviation
of) one of the strings |
reorder_dendrogram |
A single boolean value indicating whether to
reorder the dendrogram based on the means. Alternatively, you can provide a
custom function that accepts an |
merge_dendrogram |
A single boolean value, indicates whether we should
merge multiple dendrograms, only used when previous groups have been
established. Default: |
reorder_group |
A single boolean value, indicates whether we should do
Hierarchical Clustering between groups, only used when previous groups have
been established. Default: |
k |
An integer scalar indicates the desired number of groups. |
h |
A numeric scalar indicates heights where the tree should be cut. |
cutree |
A function used to cut the |
plot_dendrogram |
A boolean value indicates whether plot the dendrogram tree. |
plot_cut_height |
A boolean value indicates whether plot the cut height. |
center |
A boolean value. if |
type |
A string indicates the plot type, |
root |
A length one string or numeric indicates the root branch. |
size |
The relative size of the plot, can be specified as a
|
data |
A matrix-like object. By default, it inherits from the layout
|
active |
A |
no_axes |
align_dendro initializes a ggplot data and mapping.
The internal ggplot object will always use a default mapping of
aes(x = .data$x, y = .data$y).
The default ggplot data is the node coordinates with edge data attached
in ggalign attribute, in addition, a
geom_segment layer with a data frame of the edge
coordinates will be added when plot_dendrogram = TRUE.
See fortify_data_frame.dendrogram() for details.
It is important to note that we consider rows as observations, meaning
vec_size(data)/NROW(data) must match the number of observations along the
axis used for alignment (x-axis for a vertical stack layout, y-axis for a
horizontal stack layout).
# align_dendro will always add a plot area
ggheatmap(matrix(rnorm(81), nrow = 9)) +
anno_top() +
align_dendro()
ggheatmap(matrix(rnorm(81), nrow = 9)) +
anno_top() +
align_dendro(k = 3L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.