Horizon Chart

API Response Time Horizon

Web API response time horizon chart showing latency patterns with cyan neon gradient.

Output
API Response Time Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bands': ['#0d3d4d', '#1a6b7a', '#22D3EE', '#27D3F5'],
    'background': '#0a0a0f',
    'text': '#ffffff',
}

np.random.seed(666)
requests = np.arange(0, 1000)
# Response time with occasional spikes
base_latency = 50 + 20 * np.sin(requests * 0.01)
spikes = np.random.choice([0, 1], size=len(requests), p=[0.97, 0.03]) * np.random.uniform(100, 300, len(requests))
latency = base_latency + spikes + np.random.exponential(10, len(requests))
latency = np.clip(latency, 20, 400)
latency_norm = latency / 400

fig, ax = plt.subplots(figsize=(14, 3), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])

band = 0.25

ax.fill_between(requests, 0, np.clip(latency_norm, 0, band), color=COLORS['bands'][0])
ax.fill_between(requests, 0, np.clip(latency_norm - band, 0, band), color=COLORS['bands'][1])
ax.fill_between(requests, 0, np.clip(latency_norm - 2*band, 0, band), color=COLORS['bands'][2])
ax.fill_between(requests, 0, np.clip(latency_norm - 3*band, 0, band), color=COLORS['bands'][3])

ax.set_xlim(0, 999)
ax.set_ylim(0, 0.3)

ax.set_title('API Response Time (ms)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Request #', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Latency (ms)', color=COLORS['text'], fontsize=10)

for spine in ax.spines.values():
    spine.set_visible(False)
ax.tick_params(colors=COLORS['text'], labelsize=9)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Time Series

Did this help you?

Support PyLucid to keep it free & growing

Support