Line & Scatter
Percentile Distribution
Time series with percentile bands showing data distribution.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# === STYLE CONFIG ===
COLORS = {
'median': '#1E293B',
'p25_75': '#3B82F6',
'p10_90': '#3B82F6',
'background': '#FFFFFF',
'text': '#1E293B',
'text_muted': '#64748B',
'grid': '#F1F5F9',
}
# === DATA ===
x = np.arange(1, 13)
median = [45, 48, 52, 55, 58, 62, 65, 63, 60, 58, 55, 52]
p25 = [38, 40, 44, 47, 50, 54, 57, 55, 52, 50, 47, 44]
p75 = [52, 56, 60, 63, 66, 70, 73, 71, 68, 66, 63, 60]
p10 = [32, 34, 38, 41, 44, 48, 51, 49, 46, 44, 41, 38]
p90 = [58, 62, 66, 69, 72, 76, 79, 77, 74, 72, 69, 66]
# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])
# === PLOT ===
# P10-P90 band
ax.fill_between(x, p10, p90, color=COLORS['p10_90'], alpha=0.1, label='P10-P90')
# P25-P75 band
ax.fill_between(x, p25, p75, color=COLORS['p25_75'], alpha=0.2, label='P25-P75')
# Median line
ax.plot(x, median, color=COLORS['median'], linewidth=2.5, label='Median', zorder=3)
ax.scatter(x, median, color=COLORS['median'], s=40,
edgecolors='white', linewidths=1.5, zorder=4)
# === AXES ===
ax.set_xlim(0.5, 12.5)
ax.set_ylim(20, 90)
ax.set_xticks(x)
ax.set_xticklabels(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
ax.set_xlabel('Month', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Value', fontsize=10, color=COLORS['text'], labelpad=10)
# === STYLING ===
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.yaxis.grid(True, color=COLORS['grid'], linewidth=1)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12),
ncol=3, frameon=False, fontsize=9, labelcolor=COLORS['text_muted'])
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Line & Scatter examples
☕