Ridgeline Plot

Server Latency by Data Center

Global infrastructure performance with neon cyber aesthetic

Output
Server Latency by Data Center
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

np.random.seed(777)

centers = ['US-East', 'US-West', 'EU-West', 'Asia-Pacific', 'South America', 'Africa']
colors = ['#276CF5', '#4927F5', '#27D3F5', '#F5B027', '#6CF527', '#F5276C']

data = {
    'US-East': np.random.lognormal(2, 0.4, 500),
    'US-West': np.random.lognormal(2.2, 0.45, 500),
    'EU-West': np.random.lognormal(2.5, 0.5, 500),
    'Asia-Pacific': np.random.lognormal(3, 0.6, 500),
    'South America': np.random.lognormal(3.2, 0.55, 500),
    'Africa': np.random.lognormal(3.5, 0.7, 500)
}

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

overlap = 1.7
x_range = np.linspace(0, 100, 300)

for i, (center, latency) in enumerate(data.items()):
    latency = np.clip(latency, 0, 100)
    kde = stats.gaussian_kde(latency, bw_method=0.3)
    y = kde(x_range) * 4
    baseline = i * overlap
    
    for w, a in [(14, 0.08), (10, 0.12), (6, 0.22), (3, 0.45)]:
        ax.plot(x_range, y + baseline, color=colors[i], linewidth=w, alpha=a)
    
    ax.fill_between(x_range, baseline, y + baseline, alpha=0.45, color=colors[i])
    ax.plot(x_range, y + baseline, color='white', linewidth=1.2, alpha=0.9)
    
    ax.text(-3, baseline + 0.15, center, fontsize=10, color=colors[i],
            ha='right', va='bottom', fontweight='600')

ax.set_xlim(-30, 100)
ax.set_ylim(-0.3, len(centers) * overlap + 2)
ax.set_xlabel('Latency (ms)', fontsize=12, color='#555555', fontweight='500')
ax.set_title('Server Latency by Data Center', fontsize=16, color='white', fontweight='bold', pad=20)

ax.tick_params(axis='x', colors='#444444', labelsize=10)
ax.tick_params(axis='y', left=False, labelleft=False)
for spine in ax.spines.values():
    spine.set_visible(False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support