Area Chart
Quantile Ribbon Plot
Time series with interquartile range ribbon - R style
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
x = np.linspace(0, 10, 100)
y_median = 50 + 20*np.sin(x) + x*2
n_series = 50
series = np.array([y_median + np.random.normal(0, 8 + x, len(x)) for _ in range(n_series)])
q25 = np.percentile(series, 25, axis=0)
q50 = np.percentile(series, 50, axis=0)
q75 = np.percentile(series, 75, axis=0)
q10 = np.percentile(series, 10, axis=0)
q90 = np.percentile(series, 90, axis=0)
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.fill_between(x, q10, q90, alpha=0.15, color='#F5276C', label='10th-90th percentile')
ax.fill_between(x, q25, q75, alpha=0.35, color='#F5276C', label='IQR (25th-75th)')
ax.plot(x, q50, color='#F5276C', linewidth=2.5, label='Median')
ax.set_xlabel('Time', color='#1f2937', fontsize=11, fontweight='500')
ax.set_ylabel('Value', color='#1f2937', fontsize=11, fontweight='500')
ax.set_title('Quantile Ribbon Plot', color='#1f2937', fontsize=13, fontweight='600', pad=15)
ax.tick_params(colors='#374151', labelsize=9)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#e5e7eb')
ax.spines['bottom'].set_color('#e5e7eb')
ax.yaxis.grid(True, color='#f3f4f6', linewidth=0.8)
ax.xaxis.grid(True, color='#f3f4f6', linewidth=0.8)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', labelcolor='#1f2937', loc='upper left')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕