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 thescipy.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
inttostr, 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) – IfTrue, create components for WebGL.
- Returns:
node_trace (
plotly.basedatatypes.BaseTraceType) – Trace object for nodes.plotly.graph_objects.Scatterobject if direction is'vertical'or'horizontal'and webgl isFalse;plotly.graph_objects.Scatterglobject if direction is'vertical'or'horizontal'and webgl isTrue;plotly.graph_objects.Scatterpolarobject if direction is'radial'and webgl isFalse;plotly.graph_objects.Scatterpolarglobject if direction is'radial'and webgl isTrue.link_traces (
dictofinttoplotly.basedatatypes.BaseTraceType) – Trace objects for links. The key is the root node ID of a dendrogram or its subtree. The value is links:plotly.graph_objects.Scatterobject if direction is'vertical'or'horizontal'and webgl isFalse;plotly.graph_objects.Scatterglobject if direction is'vertical'or'horizontal'and webgl isTrue;plotly.graph_objects.Scatterpolarobject if direction is'radial'and webgl isFalse;plotly.graph_objects.Scatterpolarglobject if direction is'radial'and webgl isTrue.axis1 (
plotly.basedatatypes.BaseLayoutHierarchyType) – Layout object for the first axis.plotly.graph_objects.layout.XAxisobject if direction is'vertical'or'horizontal';plotly.graph_objects.layout.polar.RadialAxisobject if direction is'radial'.axis2 (
plotly.basedatatypes.BaseLayoutHierarchyType) – Layout object for the second axis.plotly.graph_objects.layout.YAxisobject if direction is'vertical'or'horizontal';plotly.graph_objects.layout.polar.AngularAxisobject if direction is'radial'.
See also
scipy.cluster.hierarchy.linkageCreate a linkage matrix for hierarchical clustering.
scipy.cluster.hierarchy.leadersFind root nodes of clusters.