Ridgeline Plot
Response Time by API Endpoint
Latency distributions with cyberpunk neon aesthetic
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(789)
endpoints = ['/users', '/products', '/orders', '/auth', '/search', '/analytics']
# Cyberpunk neon palette
colors = ['#F5276C', '#F54927', '#F5B027', '#27D3F5', '#6CF527', '#4927F5']
data = {
'/users': np.random.lognormal(2.5, 0.5, 500),
'/products': np.random.lognormal(3, 0.6, 500),
'/orders': np.random.lognormal(3.5, 0.7, 500),
'/auth': np.random.lognormal(2, 0.4, 500),
'/search': np.random.lognormal(4, 0.8, 500),
'/analytics': np.random.lognormal(4.5, 0.9, 500)
}
fig, ax = plt.subplots(figsize=(12, 8), facecolor='#020B14')
ax.set_facecolor('#020B14')
overlap = 1.7
x_range = np.linspace(0, 300, 300)
for i, (endpoint, latency) in enumerate(data.items()):
latency = np.clip(latency, 0, 300)
kde = stats.gaussian_kde(latency, bw_method=0.3)
y = kde(x_range) * 3.8
baseline = i * overlap
# Neon glow layers
ax.plot(x_range, y + baseline, color=colors[i], linewidth=10, alpha=0.15)
ax.plot(x_range, y + baseline, color=colors[i], linewidth=6, alpha=0.25)
ax.plot(x_range, y + baseline, color=colors[i], linewidth=3, alpha=0.5)
ax.fill_between(x_range, baseline, y + baseline, alpha=0.4, color=colors[i])
ax.plot(x_range, y + baseline, color='white', linewidth=1.2, alpha=0.9)
ax.text(-8, baseline + 0.15, endpoint, fontsize=10, color=colors[i],
ha='right', va='bottom', fontweight='600', family='monospace')
ax.set_xlim(-50, 300)
ax.set_ylim(-0.3, len(endpoints) * overlap + 2)
ax.set_xlabel('Response Time (ms)', fontsize=12, color='#555555', fontweight='500')
ax.set_title('Response Time by API Endpoint', 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
More Ridgeline Plot examples
☕