Plotly Dendrogram Plot

This example demonstrates how to create a dendrogram plot using the Plotly library.

Python
import plotly.figure_factory as ff
import scipy  # required by ff.create_dendrogram
import pandas as pd
import numpy as np

# Define the data
index= ['A','B','C','D','E','F','G','H','I','J']
data = pd.DataFrame(abs(np.random.randn(10, 10)), index=index)

# Create the dendrogram plot
fig = ff.create_dendrogram(data, labels=index, orientation="right")

# Update the layout
fig.update_layout(
    title='Dendrogram Plot',
    width=600,
    height=400,
    showlegend=False
)

# Show the plot
fig.show()
AI Prompt