Polar Chart

Polar Area Chart

Radial area chart for cyclical data.

Output
Polar Area Chart
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {'area': '#6366F1', 'background': '#FFFFFF', 'text': '#1E293B', 'text_muted': '#64748B'}

months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
values = [65, 70, 75, 85, 90, 95, 100, 95, 85, 75, 70, 65]

angles = np.linspace(0, 2*np.pi, len(months), endpoint=False).tolist()
values_plot = values + [values[0]]
angles += [angles[0]]

fig, ax = plt.subplots(figsize=(8, 8), dpi=100, subplot_kw=dict(polar=True))
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

ax.fill(angles, values_plot, color=COLORS['area'], alpha=0.4)
ax.plot(angles, values_plot, color=COLORS['area'], linewidth=2)

ax.set_xticks(angles[:-1])
ax.set_xticklabels(months, fontsize=9, color=COLORS['text'])
ax.tick_params(axis='y', colors=COLORS['text_muted'], labelsize=8)
ax.set_ylim(0, 110)
ax.grid(color=COLORS['text_muted'], alpha=0.3)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Part-to-Whole

Did this help you?

Support PyLucid to keep it free & growing

Support