Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersReturnsBackRef
set_link_color_palette(palette)

Note that this palette is global (i.e., setting it once changes the colors for all subsequent calls to dendrogram) and that it affects only the the colors below color_threshold.

Note that dendrogram also accepts a custom coloring function through its link_color_func keyword, which is more flexible and non-global.

Notes

Ability to reset the palette with None added in SciPy 0.17.0.

Parameters

palette : list of str or None

A list of matplotlib color codes. The order of the color codes is the order in which the colors are cycled through when color thresholding in the dendrogram.

If None, resets the palette to its default (which are matplotlib default colors C1 to C9).

Returns

None

Set list of matplotlib color codes for use by dendrogram.

See Also

dendrogram

Examples

import numpy as np
from scipy.cluster import hierarchy
ytdist = np.array([662., 877., 255., 412., 996., 295., 468., 268.,
                   400., 754., 564., 138., 219., 869., 669.])
Z = hierarchy.linkage(ytdist, 'single')
dn = hierarchy.dendrogram(Z, no_plot=True)
dn['color_list']
hierarchy.set_link_color_palette(['c', 'm', 'y', 'k'])
dn = hierarchy.dendrogram(Z, no_plot=True, above_threshold_color='b')
dn['color_list']
dn = hierarchy.dendrogram(Z, no_plot=True, color_threshold=267,
                          above_threshold_color='k')
dn['color_list']
Now, reset the color palette to its default:
hierarchy.set_link_color_palette(None)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.cluster.hierarchy:dendrogram

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

scipy.cluster.hierarchy:dendrogramhierarchy:dendrogramdendrogramdendrogram

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/cluster/hierarchy.py#2952
type: <class 'function'>
Commit: