Ridgeline Plot
Rainfall Distribution by Season
Seasonal precipitation patterns throughout the year
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(42)
seasons = ['Winter', 'Spring', 'Summer', 'Fall']
rain_means = [85, 110, 45, 95]
rain_stds = [30, 35, 20, 28]
fig, ax = plt.subplots(figsize=(12, 7), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
colors = ['#276CF5', '#6CF527', '#F5B027', '#F54927']
x = np.linspace(0, 200, 200)
overlap = 2.5
for i, (season, mean, std, color) in enumerate(zip(seasons, rain_means, rain_stds, colors)):
data = np.random.normal(mean, std, 1000)
data = np.clip(data, 0, None)
kde = stats.gaussian_kde(data)
y = kde(x) * 12
y_offset = i * overlap
ax.fill_between(x, y_offset, y + y_offset, alpha=0.85, color=color, edgecolor='#374151', linewidth=0.8)
ax.text(-8, y_offset + 0.4, season, fontsize=11, color='#1f2937', va='center', ha='right', fontweight='500')
ax.set_xlim(-35, 200)
ax.set_ylim(-0.5, len(seasons) * overlap + 2)
ax.set_xlabel('Rainfall (mm)', color='#1f2937', fontsize=11, fontweight='500')
ax.set_title('Rainfall Distribution by Season', color='#1f2937', fontsize=14, fontweight='bold', pad=20)
ax.tick_params(colors='#374151', labelsize=9)
ax.set_yticks([])
for spine in ax.spines.values():
spine.set_visible(False)
ax.spines['bottom'].set_visible(True)
ax.spines['bottom'].set_color('#e5e7eb')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Ridgeline Plot examples
☕