Horizon Chart

Rainfall Intensity Horizon

Weather data horizon chart showing rainfall intensity over a week with blue water-like gradient.

Output
Rainfall Intensity Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bands': ['#E0F2FE', '#7DD3FC', '#0EA5E9', '#0284C7'],
    'background': '#ffffff',
    'text': '#1f2937',
    'grid': '#e5e7eb',
}

np.random.seed(1919)
hours = np.arange(0, 168)  # Week
# Rainfall: storms with varying intensity
rain_events = np.zeros(len(hours))
storm_starts = [20, 55, 100, 140]
for start in storm_starts:
    duration = np.random.randint(8, 20)
    intensity = np.random.uniform(5, 30)
    rain_events[start:start+duration] = intensity * np.random.uniform(0.5, 1.5, min(duration, len(hours)-start))
rain = rain_events + np.random.exponential(0.5, len(hours))
rain = np.clip(rain, 0, 50)
rain_norm = rain / 50

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(rain_norm, 0, band), color=COLORS['bands'][0])
ax.fill_between(hours, 0, np.clip(rain_norm - band, 0, band), color=COLORS['bands'][1])
ax.fill_between(hours, 0, np.clip(rain_norm - 2*band, 0, band), color=COLORS['bands'][2])
ax.fill_between(hours, 0, np.clip(rain_norm - 3*band, 0, band), color=COLORS['bands'][3])

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

ax.set_title('Rainfall Intensity (mm/hour)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Day', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Rain (mm/hr)', color=COLORS['text'], fontsize=10)
ax.set_xticks([0, 24, 48, 72, 96, 120, 144])
ax.set_xticklabels(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'])

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