Horizon Chart

Network Packet Loss Horizon

Network diagnostics horizon chart showing packet loss rates with magenta/pink neon gradient.

Output
Network Packet Loss Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bands': ['#4d1a4d', '#802080', '#D946EF', '#F0ABFC'],
    'background': '#0a0a0f',
    'text': '#ffffff',
}

np.random.seed(1414)
seconds = np.arange(0, 600)  # 10 minutes
# Packet loss: mostly low with spikes during congestion
base = np.random.exponential(0.5, len(seconds))
congestion = np.random.choice([0, 1], size=len(seconds), p=[0.95, 0.05]) * np.random.uniform(3, 8, len(seconds))
loss = base + congestion
loss = np.clip(loss, 0, 10)
loss_norm = loss / 10

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

band = 0.25

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

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

ax.set_title('Network Packet Loss (%)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Time', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Packet Loss (%)', color=COLORS['text'], fontsize=10)
ax.set_xticks([0, 120, 240, 360, 480, 600])
ax.set_xticklabels(['0:00', '2:00', '4:00', '6:00', '8:00', '10:00'])

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