Area Chart
Marathon Pace Analysis
Running pace variation through marathon kilometers
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
km = np.arange(1, 43)
# Pace starts fast, slows at "the wall" (km 30-35), then finishes strong
base_pace = 5.0 # min/km
fatigue = 0.015 * km
wall_effect = 0.5 * np.exp(-((km - 32)**2) / 10)
finish_kick = -0.3 * np.exp(-((km - 42)**2) / 5)
pace = base_pace + fatigue + wall_effect + finish_kick + np.random.normal(0, 0.1, len(km))
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
# Color by pace zone
target = 5.2
ax.fill_between(km, target, pace, where=(pace <= target), alpha=0.5, color='#6CF527', label='Below target')
ax.fill_between(km, target, pace, where=(pace > target), alpha=0.5, color='#F5276C', label='Above target')
ax.plot(km, pace, color='#1f2937', linewidth=2)
ax.axhline(target, color='#4927F5', linewidth=2, linestyle='--', label=f'Target ({target} min/km)')
# "The Wall" annotation
ax.annotate('The Wall', xy=(32, pace[31]), xytext=(25, 6.0),
arrowprops=dict(arrowstyle='->', color='#F5276C'),
color='#F5276C', fontsize=10, fontweight='bold')
ax.set_xlabel('Kilometer', color='#1f2937', fontsize=11)
ax.set_ylabel('Pace (min/km)', color='#1f2937', fontsize=11)
ax.set_title('Marathon Pace Profile', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#374151', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.invert_yaxis() # Lower pace is better
ax.set_xlim(1, 42)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', labelcolor='#1f2937')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕