Dendrogram
Pharmaceutical Compound Clusters Light
Drug compound similarity clustering with light theme
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(42)
# Drug compound data
compounds = ['Aspirin', 'Ibuprofen', 'Acetaminophen', 'Naproxen', 'Diclofenac',
'Celecoxib', 'Meloxicam', 'Piroxicam', 'Indomethacin', 'Ketoprofen',
'Metformin', 'Glipizide', 'Sitagliptin', 'Lisinopril', 'Losartan']
data = np.random.rand(len(compounds), 8) * 100
Z = linkage(data, method='ward')
fig, ax = plt.subplots(figsize=(14, 8), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
set_link_color_palette(['#F5276C', '#27D3F5', '#6CF527', '#F5B027', '#4927F5'])
dn = dendrogram(Z, labels=compounds, leaf_rotation=45, leaf_font_size=10,
color_threshold=0.7*max(Z[:,2]), above_threshold_color='#9ca3af', ax=ax)
ax.set_title('Pharmaceutical Compound Similarity Clustering', fontsize=16,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xlabel('Compound', fontsize=12, color='#374151')
ax.set_ylabel('Distance', fontsize=12, 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
More Dendrogram examples
☕