Dendrogram
Crypto Asset Clustering
Cryptocurrency correlation dendrogram
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(111)
cryptos = ['BTC', 'ETH', 'BNB', 'SOL', 'ADA', 'XRP', 'DOT', 'AVAX',
'MATIC', 'LINK', 'ATOM', 'UNI']
# Simulated price correlation data
data = np.random.randn(len(cryptos), 10)
data[0:2] += 2 # BTC, ETH similar
data[3:6] += 1 # SOL, ADA, XRP similar
Z = linkage(data, method='ward')
fig, ax = plt.subplots(figsize=(11, 7), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
set_link_color_palette(['#F5B027', '#6CF527', '#27D3F5', '#F5276C'])
dn = dendrogram(Z, labels=cryptos, leaf_rotation=0, leaf_font_size=11,
color_threshold=6, above_threshold_color='#444444', ax=ax)
ax.set_title('Cryptocurrency Price Correlation Clusters', color='white', fontsize=14, fontweight='bold', pad=15)
ax.set_ylabel('Correlation Distance', color='#888888', fontsize=11)
ax.tick_params(axis='both', colors='white', labelsize=10)
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
☕