pdendro.attach_dendrogram¶
- pdendro.attach_dendrogram(fig, Z, *, labels=None, subtrees=(), subtree_colors=None, subtree_colorway=None, default_color=None, direction='vertical', n_segments=8, webgl=False, row=None, col=None)¶
Attach dendrogram components to a figure.
- Parameters:
fig (
plotly.graph_objects.Figureorplotly.graph_objects.FigureWidget) – Figure to which dendrogram components are attached.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.row (
int, optional) – One-based row index of a subplot to which dendrogram components are attached. If not given, it is assumed that the figure does not have subplots.col (
int, optional) – One-based column index of a subplot to which dendrogram components are attached. If not given, it is assumed that the figure does not have subplots.
- Returns:
plotly.graph_objects.Figureorplotly.graph_objects.FigureWidget– Given figure.
See also
scipy.cluster.hierarchy.linkageCreate a linkage matrix for hierarchical clustering.
scipy.cluster.hierarchy.leadersFind root nodes of clusters.