Dendrogram

Vehicle Type Classification Light

Automotive classification hierarchy with neon palette

Output
Vehicle Type Classification 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(369)

vehicles = ['Sedan', 'SUV', 'Truck', 'Coupe', 'Hatchback', 'Minivan',
            'Sports Car', 'Convertible', 'Wagon', 'Crossover', 'EV Sedan', 'EV SUV']

specs = np.random.rand(len(vehicles), 6) * 100
Z = linkage(specs, method='ward')

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

set_link_color_palette(['#F5276C', '#27D3F5', '#6CF527', '#F5D327', '#5314E6'])

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

ax.set_title('Vehicle Type Classification Hierarchy', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=18)
ax.set_xlabel('Vehicle Type', fontsize=11, color='#374151')
ax.set_ylabel('Specification 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')
ax.yaxis.grid(True, color='#f9fafb', linewidth=0.8)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support