Horizon Chart

Website Traffic Horizon

Web analytics horizon chart showing visitor traffic patterns with blue gradient bands.

Output
Website Traffic Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bands': ['#DBEAFE', '#93C5FD', '#3B82F6', '#2563EB'],
    'background': '#ffffff',
    'text': '#1f2937',
    'grid': '#e5e7eb',
}

np.random.seed(1717)
hours = np.arange(0, 720)  # 30 days
# Traffic: workday pattern with campaign spikes
daily = 50 + 30 * np.sin(hours * 2 * np.pi / 24 - np.pi/4)
weekly = 20 * np.cos(hours * 2 * np.pi / 168)
campaign = np.zeros(len(hours))
campaign[200:220] = 40  # Marketing campaign
traffic = daily + weekly + campaign + np.random.exponential(10, len(hours))
traffic = np.clip(traffic, 0, 150)
traffic_norm = traffic / 150

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

band = 0.25

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

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

ax.set_title('Website Visitors (thousands/hour)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Day', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Visitors/hr', color=COLORS['text'], fontsize=10)
ax.set_xticks([0, 168, 336, 504, 672])
ax.set_xticklabels(['Week 1', 'Week 2', 'Week 3', 'Week 4', ''])

for spine in ax.spines.values():
    spine.set_color(COLORS['grid'])
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