dendrogram_data {ggalign} | R Documentation |
Dengrogram x and y coordinates
Description
Dengrogram x and y coordinates
Usage
dendrogram_data(
tree,
priority = "right",
center = FALSE,
type = "rectangle",
leaf_pos = NULL,
leaf_braches = NULL,
branch_gap = NULL,
root = NULL
)
Arguments
tree |
A hclust or a dendrogram object. |
priority |
A string of "left" or "right". if we draw from right to left,
the left will override the right, so we take the |
center |
A boolean value. if |
type |
A string indicates the plot type, |
leaf_pos |
The x-coordinates of the leaf node. Must be the same length
of the number of observations in |
leaf_braches |
Branches of the leaf node. Must be the same length of the
number of observations in |
branch_gap |
A single numeric value indicates the gap between different branches. |
root |
A length one string or numeric indicates the root branch. |
Value
A list of 2 data.frame. One for node coordinates, another for edge
coordinates.
node
and tree segments edge
coordinates contains following columns:
-
index
: the original index in the tree for the current node -
label
: node label text -
x
andy
: x-axis and y-axis coordinates for current node or the start node of the current edge. -
xend
andyend
: the x-axis and y-axis coordinates of the terminal node for current edge. -
branch
: which branch current node or edge is. You can use this column to color different groups. -
panel
: which panel current node is, if we split the plot into panel using facet_grid, this column will show which panel current node or edge is from. Note: some nodes may fall outside panel (between two panels), so there are possibleNA
values in this column. We also provideggpanel
column, which always give the right branch for usage of the ggplot facet. -
ggpanel
: Seepanel
, this is what we often used. -
panel1
andpanel2
: The panel1 and panel2 variables have the same functionality aspanel
, but they are specifically for theedge
data and correspond to both nodes of each edge. -
leaf
: A logical value indicates whether current node is a leaf.
Examples
dendrogram_data(hclust(dist(USArrests), "ave"))