Radar Chart
MLB Player Performance Analysis
Dark-themed radar chart comparing baseball players across batting, power, speed, defense, and clutch performance.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Baseball player stats
categories = ['Contact Hitting', 'Power', 'Speed', 'Defense',
'Clutch Performance', 'Plate Discipline', 'Baserunning', 'Durability']
power_hitter = [75, 98, 60, 70, 85, 78, 65, 85]
contact_hitter = [95, 65, 88, 82, 80, 90, 85, 90]
five_tool = [88, 85, 92, 90, 85, 85, 90, 88]
defensive = [78, 70, 75, 98, 75, 80, 80, 92]
N = len(categories)
angles = np.linspace(0, 2 * np.pi, N, endpoint=False).tolist()
angles += angles[:1]
power_hitter += power_hitter[:1]
contact_hitter += contact_hitter[:1]
five_tool += five_tool[:1]
defensive += defensive[:1]
fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
ax.plot(angles, power_hitter, 'o-', linewidth=2.5, color='#C82909', label='Power Hitter', markersize=7)
ax.fill(angles, power_hitter, alpha=0.2, color='#C82909')
ax.plot(angles, contact_hitter, 's-', linewidth=2.5, color='#27D3F5', label='Contact Hitter', markersize=7)
ax.fill(angles, contact_hitter, alpha=0.2, color='#27D3F5')
ax.plot(angles, five_tool, '^-', linewidth=2.5, color='#F5D327', label='Five-Tool Player', markersize=7)
ax.fill(angles, five_tool, alpha=0.2, color='#F5D327')
ax.plot(angles, defensive, 'D-', linewidth=2.5, color='#6CF527', label='Defensive Specialist', markersize=7)
ax.fill(angles, defensive, alpha=0.2, color='#6CF527')
ax.set_xticks(angles[:-1])
ax.set_xticklabels(categories, fontsize=10, color='#e2e8f0', fontweight='500')
ax.set_ylim(0, 100)
ax.yaxis.grid(True, color='#1e293b', linestyle='-', linewidth=0.8)
ax.xaxis.grid(True, color='#334155', linestyle='-', linewidth=0.5)
ax.spines['polar'].set_color('#334155')
ax.tick_params(axis='y', colors='#94a3b8')
ax.set_title('MLB Player Archetypes', fontsize=16, color='#f8fafc',
fontweight='bold', pad=25)
ax.legend(loc='upper right', bbox_to_anchor=(1.25, 1.1), fontsize=10,
frameon=True, facecolor='#1e293b', edgecolor='#334155', labelcolor='#e2e8f0')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Polar Charts
☕