Area Chart
Solar Power Generation
Daily solar panel output with cloud cover impact
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
hours = np.linspace(5, 20, 100) # Daylight hours
# Solar curve with cloud dips
base_solar = 8 * np.sin(np.pi * (hours - 5) / 15) ** 2
clouds = np.random.choice([0, 1], size=len(hours), p=[0.7, 0.3])
cloud_effect = 1 - 0.6 * np.convolve(clouds, np.ones(10)/10, mode='same')
actual = base_solar * cloud_effect
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.fill_between(hours, 0, base_solar, alpha=0.2, color='#F5B027', label='Potential')
ax.fill_between(hours, 0, actual, alpha=0.6, color='#F5B027', label='Actual')
ax.plot(hours, actual, color='#F54927', linewidth=2)
# Total energy annotation
total_kwh = np.trapezoid(actual, hours)
ax.text(0.98, 0.95, f'Total: {total_kwh:.1f} kWh', transform=ax.transAxes,
color='#1f2937', fontsize=12, fontweight='bold', ha='right', va='top',
bbox=dict(boxstyle='round', facecolor='#F5B027', alpha=0.3))
ax.set_xlabel('Hour', color='#1f2937', fontsize=11)
ax.set_ylabel('Power Output (kW)', color='#1f2937', fontsize=11)
ax.set_title('Solar Panel Daily Generation', 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.set_xlim(5, 20)
ax.set_ylim(0, 10)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', labelcolor='#1f2937')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕