Error Bar Chart

Energy Cost Comparison LCOE

Levelized cost of energy trends showing renewable energy becoming cheaper than coal.

Output
Energy Cost Comparison LCOE
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

years = ['2018', '2019', '2020', '2021', '2022', '2023']
solar = np.array([48, 42, 37, 33, 30, 28])
wind = np.array([52, 46, 41, 38, 35, 32])
coal = np.array([65, 68, 62, 72, 85, 82])
solar_err = np.array([5, 4, 4, 3, 3, 2])
wind_err = np.array([6, 5, 5, 4, 4, 3])
coal_err = np.array([8, 10, 8, 12, 15, 12])

fig, ax = plt.subplots(figsize=(11, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

x = np.arange(len(years))

ax.errorbar(x, solar, yerr=solar_err, fmt='o-', color='#F5B027',
            ecolor='#F5B027', elinewidth=2, capsize=5, markersize=10,
            markeredgecolor='#1f2937', linewidth=3, label='Solar PV', alpha=0.9)
ax.fill_between(x, solar - solar_err, solar + solar_err, color='#F5B027', alpha=0.15)

ax.errorbar(x, wind, yerr=wind_err, fmt='s-', color='#27D3F5',
            ecolor='#27D3F5', elinewidth=2, capsize=5, markersize=9,
            markeredgecolor='#1f2937', linewidth=3, label='Wind', alpha=0.9)
ax.fill_between(x, wind - wind_err, wind + wind_err, color='#27D3F5', alpha=0.15)

ax.errorbar(x, coal, yerr=coal_err, fmt='^-', color='#374151',
            ecolor='#374151', elinewidth=2, capsize=5, markersize=9,
            markeredgecolor='#1f2937', linewidth=3, label='Coal', alpha=0.9)
ax.fill_between(x, coal - coal_err, coal + coal_err, color='#374151', alpha=0.1)

ax.set_xlabel('Year', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('LCOE ($/MWh)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Levelized Cost of Energy: Renewables vs Coal', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=20)

ax.set_xticks(x)
ax.set_xticklabels(years, fontsize=11)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=11)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(15, 110)
ax.grid(True, alpha=0.4, color='#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#d1d5db')
ax.spines['bottom'].set_color('#d1d5db')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support