""" Individually specifying subtree color ===================================== """ # %% # The colors of subtrees are automatically picked from a colorway given by # the `subtree_colorway` parameter or from # the :attr:`~plotly.graph_objects.Layout.colorway` attribute of # the :attr:`~plotly.graph_objects.Figure.layout` attribute of a figure. These colors can be changed # using the `subtree_colors` parameter. import plotly.graph_objects as go import plotly.io as pio import scipy from pdendro import attach_dendrogram X = [[0.0], [1.0], [3.0], [6.0]] Z = scipy.cluster.hierarchy.linkage(X) fig = go.Figure() attach_dendrogram(fig, Z, subtrees={2, 4}, subtree_colors={4: "#00ff00"}) pio.show(fig)