Ridgeline Plot
Sales Distribution by Region
Regional sales performance comparison
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(42)
regions = ['North America', 'Europe', 'Asia Pacific', 'Latin America', 'Middle East']
avg_sales = [85000, 72000, 95000, 45000, 38000]
variations = [25000, 20000, 30000, 15000, 12000]
fig, ax = plt.subplots(figsize=(12, 8), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
colors = ['#F5276C', '#F5B027', '#27D3F5', '#6CF527', '#4927F5']
x = np.linspace(0, 180000, 200)
overlap = 2.2
for i, (region, avg, var, color) in enumerate(zip(regions, avg_sales, variations, colors)):
data = np.random.normal(avg, var, 1000)
kde = stats.gaussian_kde(data)
y = kde(x) * 8000
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(-5000, y_offset + 0.3, region, fontsize=10, color='#1f2937', va='center', ha='right', fontweight='500')
ax.set_xlim(-45000, 180000)
ax.set_ylim(-0.5, len(regions) * overlap + 2)
ax.set_xlabel('Annual Sales ($)', color='#1f2937', fontsize=11, fontweight='500')
ax.set_title('Sales Distribution by Region', color='#1f2937', fontsize=14, fontweight='bold', pad=20)
ax.tick_params(colors='#374151', labelsize=9)
ax.xaxis.set_major_formatter(plt.FuncFormatter(lambda x, p: f'${x/1000:.0f}K'))
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
☕