Horizon Chart
Climate Temperature Anomaly
Horizon chart visualizing temperature anomalies with warm orange for above-average and cool blue for below-average temps.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'warm': ['#4d2600', '#994d00', '#F5B027'], # Orange gradient
'cool': ['#002040', '#004080', '#276CF5'], # Blue gradient
'background': '#0a0a0f',
'text': '#ffffff',
}
np.random.seed(2024)
years = np.arange(1900, 2024)
# Climate warming trend
anomaly = 0.01 * (years - 1960) + 0.3 * np.sin(years * 0.1) + np.random.normal(0, 0.15, len(years))
fig, ax = plt.subplots(figsize=(14, 3), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])
band = 0.3
# Warm anomalies
ax.fill_between(years, 0, np.clip(anomaly, 0, band), color=COLORS['warm'][0])
ax.fill_between(years, 0, np.clip(anomaly - band, 0, band), color=COLORS['warm'][1])
ax.fill_between(years, 0, np.clip(anomaly - 2*band, 0, band), color=COLORS['warm'][2])
# Cool anomalies
ax.fill_between(years, 0, np.clip(anomaly, -band, 0), color=COLORS['cool'][0])
ax.fill_between(years, 0, np.clip(anomaly + band, -band, 0), color=COLORS['cool'][1])
ax.fill_between(years, 0, np.clip(anomaly + 2*band, -band, 0), color=COLORS['cool'][2])
ax.axhline(0, color='#555555', linewidth=0.5)
ax.set_xlim(1900, 2023)
ax.set_ylim(-0.35, 0.35)
ax.set_title('Global Temperature Anomaly (1900-2023)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Year', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Anomaly (°C)', 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
More Horizon Chart examples
☕