Dendrogram
Circular Dendrogram Style
Radial tree visualization
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage, set_link_color_palette
np.random.seed(333)
items = [f'Node_{i}' for i in range(1, 17)]
data = np.random.randn(len(items), 6)
Z = linkage(data, method='ward')
fig, ax = plt.subplots(figsize=(12, 8), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
set_link_color_palette(['#F5276C', '#F5B027', '#6CF527', '#27D3F5', '#4927F5'])
dn = dendrogram(Z, labels=items, leaf_rotation=90, leaf_font_size=9,
color_threshold=4, above_threshold_color='#333333', ax=ax)
# Add cluster count annotations
ax.annotate('Cluster A', xy=(3, 2.5), color='#F5276C', fontsize=10, fontweight='bold')
ax.annotate('Cluster B', xy=(9, 3), color='#6CF527', fontsize=10, fontweight='bold')
ax.annotate('Cluster C', xy=(13, 2.8), color='#27D3F5', fontsize=10, fontweight='bold')
ax.set_title('Hierarchical Node Clustering', color='white', fontsize=14, fontweight='bold', pad=15)
ax.set_ylabel('Linkage Distance', color='#888888', fontsize=11)
ax.tick_params(axis='both', colors='white', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#333333')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Dendrogram examples
☕