Stackplot
Subscription Tiers
User distribution by plan tier.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'enterprise': '#6366F1',
'pro': '#10B981',
'basic': '#F59E0B',
'free': '#94A3B8',
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9'
}
months = np.arange(1, 25)
free = 10000 - 200*months + np.random.normal(0, 100, 24)
basic = 2000 + 150*months + np.random.normal(0, 50, 24)
pro = 500 + 100*months + np.random.normal(0, 30, 24)
enterprise = 50 + 25*months + np.random.normal(0, 5, 24)
fig, ax = plt.subplots(figsize=(12, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
ax.stackplot(months, enterprise, pro, basic, free,
colors=[COLORS['enterprise'], COLORS['pro'], COLORS['basic'], COLORS['free']],
alpha=0.85, labels=['Enterprise', 'Pro', 'Basic', 'Free'])
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color(COLORS['grid'])
ax.spines['bottom'].set_color(COLORS['grid'])
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)
ax.set_xlim(1, 24)
ax.set_xlabel('Month', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Users', fontsize=10, color=COLORS['text'], labelpad=10)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), ncol=4, frameon=False, fontsize=9, labelcolor=COLORS['text_muted'])
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Stackplot examples
☕