Polar Chart

24-Hour Traffic Pattern

Website traffic distribution across hours with glow effect

Output
24-Hour Traffic Pattern
Python
import matplotlib.pyplot as plt
import numpy as np

hours = [f'{i}:00' for i in range(24)]
traffic = [12, 8, 5, 4, 5, 8, 25, 55, 78, 85, 82, 88, 92, 85, 80, 75, 82, 90, 88, 72, 55, 42, 28, 18]

angles = np.linspace(0, 2 * np.pi, 24, endpoint=False)
traffic_closed = traffic + [traffic[0]]
angles_closed = np.append(angles, angles[0])

fig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

for lw, alpha in [(10, 0.1), (6, 0.2), (3, 0.4)]:
    ax.plot(angles_closed, traffic_closed, color='#6CF527', linewidth=lw, alpha=alpha)
ax.plot(angles_closed, traffic_closed, color='#6CF527', linewidth=2)
ax.fill(angles_closed, traffic_closed, color='#6CF527', alpha=0.2)

ax.set_xticks(angles[::3])
ax.set_xticklabels([hours[i] for i in range(0, 24, 3)], fontsize=10, color='white', fontweight='500')
ax.set_ylim(0, 100)
ax.set_yticks([25, 50, 75, 100])
ax.set_yticklabels(['', '', '', ''], fontsize=9)
ax.spines['polar'].set_color('#555555')
ax.grid(color='#555555', linewidth=0.8, alpha=0.7)
ax.set_title('24-Hour Traffic Pattern', fontsize=16, color='white', fontweight='bold', pad=20, y=1.08)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support