Dendrogram

Species Taxonomy Dendrogram Light

Biological taxonomy clustering with neon colors on light background

Output
Species Taxonomy Dendrogram 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(123)

species = ['H. sapiens', 'P. troglodytes', 'G. gorilla', 'P. pygmaeus',
           'M. musculus', 'R. norvegicus', 'C. familiaris', 'F. catus',
           'B. taurus', 'S. scrofa', 'E. caballus', 'O. aries']

genetic_data = np.random.rand(len(species), 10) * 50
Z = linkage(genetic_data, method='average')

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

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

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

ax.set_title('Mammalian Species Phylogenetic Tree', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=18)
ax.set_xlabel('Species', fontsize=11, color='#374151')
ax.set_ylabel('Genetic Distance', fontsize=11, color='#374151')

ax.tick_params(axis='both', colors='#374151', labelsize=10)
for spine in ['top', 'right']:
    ax.spines[spine].set_visible(False)
for spine in ['left', 'bottom']:
    ax.spines[spine].set_color('#e5e7eb')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support