Expand description
StatTree: hierarchical node-link layouts (tidy tree / dendrogram /
org chart).
Input: parent → child links (from = parent, to = child). Nodes with
no parent are roots (several roots lay out side by side). Leaves are
spaced one unit apart in depth-first order and every parent is centred
over its children, so subtrees never overlap. A node’s level is its depth
(root 0) unless height names a column holding each link’s parent
height (dendrograms: leaves at 0, merges at their merge height).
Output: one row per node (part = "node", x/y, node, depth,
leaf) then one per link (part = "link", x/y = parent, xend/
yend = child, from, to), already oriented (top-down, left-right or
radial), plus xmin/xmax/ymin/ymax framing the layout.
Structs§
Enums§
- Tree
Orientation - Tree orientation.
Functions§
- dendrogram_
links - Parent → child links for a dendrogram from an R
hclust-style merge matrix: rowkmergesaandb(negative = leaf-a, 1-based; positive = the cluster formed at rowa) atheights[k]. Returns columnsfrom,toandheight(the parent’s merge height) ready forgeom_dendrogram; leaves are named bylabels(1-based leafi→labels[i - 1]), clusters"#k".