Radar Chart
Flagship Smartphone Comparison
Feature-by-feature comparison of premium smartphones.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Smartphone comparison
categories = ['Camera', 'Battery', 'Display', 'Performance', 'Build Quality', 'Value']
iphone = [95, 80, 92, 95, 95, 70]
samsung = [92, 88, 95, 90, 90, 78]
pixel = [98, 82, 88, 88, 85, 85]
N = len(categories)
angles = np.linspace(0, 2 * np.pi, N, endpoint=False).tolist()
angles += angles[:1]
iphone += iphone[:1]
samsung += samsung[:1]
pixel += pixel[:1]
fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.plot(angles, iphone, 'o-', linewidth=2.5, color='#374151', label='iPhone 15 Pro', markersize=7)
ax.fill(angles, iphone, alpha=0.15, color='#374151')
ax.plot(angles, samsung, 's-', linewidth=2.5, color='#5314E6', label='Galaxy S24 Ultra', markersize=7)
ax.fill(angles, samsung, alpha=0.15, color='#5314E6')
ax.plot(angles, pixel, '^-', linewidth=2.5, color='#6CF527', label='Pixel 8 Pro', markersize=7)
ax.fill(angles, pixel, alpha=0.15, 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('Flagship Smartphone Comparison', fontsize=16, color='#1f2937',
fontweight='bold', pad=20)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Polar Charts
☕