dendrogram_data {ggalign} | R Documentation |
Dengrogram x and y coordinates
dendrogram_data(
tree,
priority = "right",
center = FALSE,
type = "rectangle",
leaf_pos = NULL,
leaf_braches = NULL,
branch_gap = NULL,
root = NULL
)
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. |
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
and y
: x-axis and y-axis coordinates for current node or the start
node of the current edge.
xend
and yend
: 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 possible
NA
values in this column. We also provide ggpanel
column,
which always give the right branch for usage of the ggplot
facet.
ggpanel
: See panel
, this is what we often used.
panel1
and panel2
: The panel1 and panel2 variables have the same
functionality as panel
, but they are specifically for the edge
data
and correspond to both nodes of each edge.
leaf
: A logical value indicates whether current node is a leaf.
dendrogram_data(hclust(dist(USArrests), "ave"))