Area Chart
API Response Times
Backend API latency distribution over 24 hours
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
hours = np.arange(0, 24)
# Response time varies with traffic
p50 = 45 + 20*np.sin(np.pi * hours/12) + np.random.normal(0, 5, 24)
p95 = p50 * 2.5 + np.random.normal(0, 10, 24)
p99 = p50 * 4 + np.random.normal(0, 20, 24)
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
ax.fill_between(hours, 0, p99, alpha=0.2, color='#F5276C', label='p99')
ax.fill_between(hours, 0, p95, alpha=0.3, color='#F5B027', label='p95')
ax.fill_between(hours, 0, p50, alpha=0.5, color='#6CF527', label='p50')
ax.plot(hours, p50, color='#6CF527', linewidth=2)
ax.plot(hours, p95, color='#F5B027', linewidth=1.5)
ax.plot(hours, p99, color='#F5276C', linewidth=1)
# SLA line
ax.axhline(200, color='#27D3F5', linewidth=1.5, linestyle='--', alpha=0.7, label='SLA (200ms)')
ax.set_xlabel('Hour of Day', color='white', fontsize=11)
ax.set_ylabel('Response Time (ms)', color='white', fontsize=11)
ax.set_title('API Latency Percentiles', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#333333')
ax.set_xlim(0, 23)
ax.legend(facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white', loc='upper right')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕