Area Chart
Daily Hydration Tracker
Water intake cumulative throughout the day
Output
Python
import matplotlib.pyplot as plt
import numpy as np
hours = np.arange(6, 23) # 6 AM to 10 PM
intake = [0, 250, 250, 500, 250, 750, 500, 500, 250, 500, 250, 500, 250, 250, 250, 250, 0]
cumulative = np.cumsum(intake)
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
# Goal area
goal = 2500
ax.axhspan(goal * 0.8, goal, alpha=0.2, color='#6CF527', label='Goal zone')
ax.axhline(goal, color='#6CF527', linewidth=2, linestyle='--')
# Cumulative intake
ax.fill_between(hours, 0, cumulative, alpha=0.5, color='#27D3F5')
ax.plot(hours, cumulative, color='#27D3F5', linewidth=2.5)
ax.scatter(hours, cumulative, color='#27D3F5', s=40, zorder=5, edgecolors='white', linewidth=1)
# Current progress
current = cumulative[-1]
pct = (current / goal) * 100
color = '#6CF527' if pct >= 80 else '#F5B027' if pct >= 50 else '#F5276C'
ax.text(0.98, 0.95, f'{current:,} ml ({pct:.0f}%)', transform=ax.transAxes,
color=color, fontsize=14, fontweight='bold', ha='right', va='top')
ax.set_xlabel('Hour', color='#1f2937', fontsize=11)
ax.set_ylabel('Water Intake (ml)', color='#1f2937', fontsize=11)
ax.set_title('Daily Hydration Progress', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#374151', labelsize=9)
ax.set_xticks(hours[::2])
ax.set_xticklabels([f'{h}:00' for h in hours[::2]], rotation=45)
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.set_xlim(6, 22)
ax.set_ylim(0, 3000)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕