Note
Go to the end to download the full example code.
SubplotΒΆ
The attach_dendrogram() function can attach a dendrogram to a subplot using
the row and col parameters.
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()
fig.set_subplots(rows=1, cols=2)
attach_dendrogram(fig, Z, direction="vertical", row=1, col=1)
attach_dendrogram(fig, Z, direction="horizontal", row=1, col=2)
pio.show(fig)