pdendro.make_components

pdendro.make_components(Z, *, labels=None, subtrees=(), subtree_colors=None, subtree_colorway=None, default_color=None, direction='vertical', n_segments=8, webgl=False)

Create dendrogram components.

Parameters:
  • Z (array-like of float) – Linkage matrix. Must be formatted as returned by the scipy.cluster.hierarchy.linkage() function.

  • labels (sequence of str, optional) – Labels of leaf nodes in ascending order of node IDs. If not given, node IDs are used.

  • subtrees (collection of int, optional) – Root node IDs of subtrees.

  • subtree_colors (mapping of int to str, optional) – Colors of subtrees. The key is the root node ID of a subtree, and the value is a color. This takes precedence over subtree_colorway.

  • subtree_colorway (sequence of str, optional) – Colorway of subtrees. Must not be empty. Colors are assigned to subtrees in descending order of their root node IDs. If the number of colors is insufficient, the sequence is cyclically extended.

  • default_color (str, optional) – Default color of a dendrogram.

  • direction ({'vertical', 'horizontal', 'radial'}, optional) – Direction of a dendrogram.

  • n_segments (int, optional) – Number of link segments between a node and a corner point on the path to its child node. Used only if direction is 'radial'.

  • webgl (bool, optional) – If True, create components for WebGL.

Returns:

See also

scipy.cluster.hierarchy.linkage

Create a linkage matrix for hierarchical clustering.

scipy.cluster.hierarchy.leaders

Find root nodes of clusters.