Skip to main content

Module tree

Module tree 

Source
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§

StatTree
Tree layout stat behind GeomTree.

Enums§

TreeOrientation
Tree orientation.

Functions§

dendrogram_links
Parent → child links for a dendrogram from an R hclust-style merge matrix: row k merges a and b (negative = leaf -a, 1-based; positive = the cluster formed at row a) at heights[k]. Returns columns from, to and height (the parent’s merge height) ready for geom_dendrogram; leaves are named by labels (1-based leaf i → labels[i - 1]), clusters "#k".