Error Bar Chart

Solar Panel Efficiency Comparison

Efficiency comparison of different solar panel technologies with measurement uncertainty.

Output
Solar Panel Efficiency Comparison
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

# Solar panel efficiency data
panel_types = ['Monocrystalline', 'Polycrystalline', 'Thin-Film', 'PERC', 'Bifacial']
efficiency = np.array([22.5, 18.5, 12.8, 24.2, 21.8])
degradation = np.array([0.5, 0.7, 0.8, 0.4, 0.55])
eff_err = np.array([1.2, 1.0, 0.8, 1.5, 1.3])

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

x = np.arange(len(panel_types))
colors = ['#4927F5', '#276CF5', '#27D3F5', '#6CF527', '#F5B027']

bars = ax.bar(x, efficiency, yerr=eff_err, capsize=6,
              color=colors, edgecolor='#1f2937', linewidth=0.8,
              error_kw={'ecolor': '#374151', 'elinewidth': 2, 'capthick': 2},
              alpha=0.9, width=0.6)

# Add efficiency labels
for bar, eff, err in zip(bars, efficiency, eff_err):
    ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + err + 0.5,
            f'{eff}%', ha='center', color='#374151', fontsize=10, fontweight='600')

ax.set_xlabel('Panel Type', fontsize=11, color='#374151', fontweight='500')
ax.set_ylabel('Efficiency (%)', fontsize=11, color='#374151', fontweight='500')
ax.set_title('Solar Panel Efficiency Comparison', fontsize=14, 
             color='#1f2937', fontweight='bold', pad=15)

ax.set_xticks(x)
ax.set_xticklabels(panel_types, rotation=15, ha='right')
ax.tick_params(colors='#6b7280', labelsize=9)
ax.set_ylim(0, 30)
ax.grid(True, axis='y', alpha=0.3, color='#d1d5db')
for spine in ax.spines.values():
    spine.set_color('#d1d5db')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support