Ridgeline Plot

App Load Time by Device

Performance metrics with electric blue gradient theme

Output
App Load Time by Device
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

np.random.seed(222)

devices = ['iPhone 15', 'Pixel 8', 'Galaxy S24', 'iPad Pro', 'MacBook', 'Windows PC']
colors = ['#276CF5', '#4927F5', '#5314E6', '#27D3F5', '#6CF527', '#F5B027']

data = {
    'iPhone 15': np.random.lognormal(0.5, 0.3, 500),
    'Pixel 8': np.random.lognormal(0.6, 0.35, 500),
    'Galaxy S24': np.random.lognormal(0.55, 0.32, 500),
    'iPad Pro': np.random.lognormal(0.4, 0.25, 500),
    'MacBook': np.random.lognormal(0.3, 0.2, 500),
    'Windows PC': np.random.lognormal(0.7, 0.4, 500)
}

fig, ax = plt.subplots(figsize=(12, 8), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

overlap = 1.6
x_range = np.linspace(0, 6, 300)

for i, (device, time) in enumerate(data.items()):
    time = np.clip(time, 0, 6)
    kde = stats.gaussian_kde(time, bw_method=0.3)
    y = kde(x_range) * 3.5
    baseline = i * overlap
    
    ax.fill_between(x_range, baseline, y + baseline, alpha=0.7, color=colors[i])
    ax.plot(x_range, y + baseline, color=colors[i], linewidth=2.5)
    
    ax.text(-0.2, baseline + 0.12, device, fontsize=10, color='#1f2937',
            ha='right', va='bottom', fontweight='600')

ax.set_xlim(-2.5, 6)
ax.set_ylim(-0.3, len(devices) * overlap + 1.8)
ax.set_xlabel('Load Time (seconds)', fontsize=12, color='#374151', fontweight='500')
ax.set_title('App Load Time by Device', fontsize=16, color='#1f2937', fontweight='bold', pad=20)

ax.tick_params(axis='x', colors='#374151', labelsize=10)
ax.tick_params(axis='y', left=False, labelleft=False)
ax.spines['bottom'].set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support