Radar Chart
NBA Player Stats Comparison
Basketball player performance metrics comparison.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Basketball player stats (normalized)
categories = ['Scoring', 'Rebounds', 'Assists', 'Defense', 'Efficiency', '3PT%']
lebron = [88, 78, 85, 75, 82, 72]
curry = [92, 45, 72, 68, 90, 98]
giannis = [90, 92, 65, 85, 78, 55]
N = len(categories)
angles = np.linspace(0, 2 * np.pi, N, endpoint=False).tolist()
angles += angles[:1]
lebron += lebron[:1]
curry += curry[:1]
giannis += giannis[:1]
fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.plot(angles, lebron, 'o-', linewidth=2.5, color='#F5B027', label='LeBron James', markersize=7)
ax.fill(angles, lebron, alpha=0.2, color='#F5B027')
ax.plot(angles, curry, 's-', linewidth=2.5, color='#276CF5', label='Stephen Curry', markersize=7)
ax.fill(angles, curry, alpha=0.2, color='#276CF5')
ax.plot(angles, giannis, '^-', linewidth=2.5, color='#6CF527', label='Giannis', markersize=7)
ax.fill(angles, giannis, alpha=0.2, color='#6CF527')
ax.set_xticks(angles[:-1])
ax.set_xticklabels(categories, fontsize=11, color='#374151', fontweight='500')
ax.set_ylim(0, 100)
ax.set_yticks([25, 50, 75, 100])
ax.set_yticklabels(['25', '50', '75', '100'], fontsize=9, color='#6b7280')
ax.yaxis.grid(True, color='#e5e7eb', linestyle='-', linewidth=0.8)
ax.xaxis.grid(True, color='#e5e7eb', linestyle='-', linewidth=0.8)
ax.legend(loc='upper right', bbox_to_anchor=(1.25, 1.1), fontsize=10,
facecolor='#ffffff', edgecolor='#e5e7eb')
plt.title('NBA Player Comparison', fontsize=16, color='#1f2937',
fontweight='bold', pad=20)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Polar Charts
☕