Note
Go to the end to download the full example code.
Hiding all node markersΒΆ
By default, markers of root nodes of subtrees are visible. Visibility is controlled by marker sizes. All node markers can be hidden by setting all marker sizes to zero.
import plotly.graph_objects as go
import plotly.io as pio
import scipy
from pdendro import make_components
X = [[0.0], [1.0], [3.0], [6.0]]
Z = scipy.cluster.hierarchy.linkage(X)
T = scipy.cluster.hierarchy.fcluster(Z, 1.5, criterion="distance")
L, _ = scipy.cluster.hierarchy.leaders(Z, T)
node_trace, link_traces, x_axis, y_axis = make_components(Z, subtrees=L)
node_trace.update(marker={"size": [0]*len(node_trace.marker.size)})
fig = go.Figure()
fig.add_traces(list(link_traces.values()))
fig.add_trace(node_trace)
fig.update_xaxes(x_axis)
fig.update_yaxes(y_axis)
pio.show(fig)
Alternatively, if the attach_dendrogram() function is used, marker sizes must be
modified later.
from pdendro import attach_dendrogram
fig = go.Figure()
attach_dendrogram(fig, Z, subtrees=L)
node_trace = fig.data[-1]
node_trace.update(marker={"size": [0]*len(node_trace.marker.size)})
pio.show(fig)