Dendrogram

Social Media Platform Similarity Light

Social platform feature clustering with bright colors

Output
Social Media Platform Similarity Light
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage, set_link_color_palette

np.random.seed(258)

platforms = ['Instagram', 'TikTok', 'YouTube', 'Twitter/X', 'Facebook',
             'LinkedIn', 'Pinterest', 'Snapchat', 'Reddit', 'Discord', 'Twitch']

features = np.random.rand(len(platforms), 7) * 100
Z = linkage(features, method='ward')

fig, ax = plt.subplots(figsize=(13, 7), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

set_link_color_palette(['#F527B0', '#27D3F5', '#6CF527', '#F5B027', '#4927F5'])

dn = dendrogram(Z, labels=platforms, leaf_rotation=40, leaf_font_size=11,
                color_threshold=0.6*max(Z[:,2]), above_threshold_color='#d1d5db', ax=ax)

ax.set_title('Social Media Platform Feature Clustering', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=18)
ax.set_xlabel('Platform', fontsize=11, color='#374151')
ax.set_ylabel('Feature Distance', fontsize=11, color='#374151')

ax.tick_params(axis='both', colors='#374151', labelsize=10)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#e5e7eb')
ax.spines['bottom'].set_color('#e5e7eb')
ax.yaxis.grid(True, color='#f3f4f6', linewidth=0.5)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support