Horizon Chart

UV Index Horizon

Weather health horizon chart showing UV radiation levels with yellow/amber gradient.

Output
UV Index Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'bands': ['#FEF9C3', '#FDE047', '#FACC15', '#EAB308'],
    'background': '#ffffff',
    'text': '#1f2937',
    'grid': '#e5e7eb',
}

np.random.seed(3333)
hours = np.linspace(0, 24, 144)  # 10-min intervals
# UV: bell curve peaking at solar noon
uv = 10 * np.exp(-((hours - 12.5)**2) / 8)
cloud_cover = np.random.choice([1, 0.7, 0.4], size=len(hours), p=[0.6, 0.3, 0.1])
uv = uv * cloud_cover + np.random.normal(0, 0.3, len(hours))
uv = np.clip(uv, 0, 12)
uv_norm = uv / 12

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

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

ax.set_title('UV Index (Daily)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Hour', color=COLORS['text'], fontsize=10)
ax.set_ylabel('UV Index', color=COLORS['text'], fontsize=10)
ax.set_xticks([0, 6, 12, 18, 24])
ax.set_xticklabels(['00:00', '06:00', '12:00', '18:00', '24:00'])

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