Area Chart
Stepped Area Chart
Discrete step-based area visualization.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Data - Pricing tiers
hours = np.arange(0, 25)
prices = [0.08, 0.08, 0.08, 0.08, 0.08, 0.08,
0.12, 0.15, 0.20, 0.25, 0.25, 0.20,
0.15, 0.12, 0.12, 0.15, 0.20, 0.25,
0.30, 0.30, 0.25, 0.15, 0.10, 0.08, 0.08]
# Figure - DARK THEME
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
# Stepped area with NEON colors
ax.fill_between(hours, 0, prices, step='post', alpha=0.4, color='#6CF527')
ax.step(hours, prices, where='post', color='#6CF527', linewidth=2.5)
# Peak hours highlight
peak_mask = np.array(prices) >= 0.25
ax.fill_between(hours, 0, np.where(peak_mask, prices, 0), step='post', alpha=0.4, color='#F5276C')
# Styling
ax.set_xlabel('Hour', color='white', fontsize=11)
ax.set_ylabel('Price ($/kWh)', color='white', fontsize=11)
ax.set_title('Dynamic Energy Pricing', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_xlim(0, 24)
ax.set_ylim(0, 0.35)
# Legend
from matplotlib.patches import Patch
legend_elements = [Patch(facecolor='#6CF527', alpha=0.4, label='Off-peak'),
Patch(facecolor='#F5276C', alpha=0.4, label='Peak hours')]
ax.legend(handles=legend_elements, facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕