Ridgeline Plot

Ridgeline Plot

Joy plot style overlapping distributions.

Output
Ridgeline Plot
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'fills': ['#6366F1', '#8B5CF6', '#A855F7', '#C084FC', '#D8B4FE'],
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
}

np.random.seed(42)
x = np.linspace(0, 10, 100)
categories = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']

fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

for i, (cat, color) in enumerate(zip(categories, COLORS['fills'])):
    y = np.sin(x + i*0.5) + np.random.normal(0, 0.1, len(x)) + 0.5
    baseline = i * 0.8
    ax.fill_between(x, baseline, baseline + y * 0.6, color=color, alpha=0.8, zorder=5-i)
    ax.plot(x, baseline + y * 0.6, color=color, linewidth=1, zorder=6-i)
    ax.text(-0.5, baseline + 0.3, cat, fontsize=10, fontweight='bold', 
            color=COLORS['text'], ha='right', va='center')

ax.set_xlim(-2, 10)
ax.set_ylim(-0.5, 5)
ax.axis('off')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support