Bar Chart

Bar Chart Error Bars Light

Bar chart with error bars in light theme

Output
Bar Chart Error Bars Light
Python
import matplotlib.pyplot as plt
import numpy as np

groups = ['Group A', 'Group B', 'Group C', 'Group D', 'Group E']
means = [52, 68, 45, 72, 58]
errors = [5, 7, 4, 6, 5]

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

x = np.arange(len(groups))
colors = ['#6366f1', '#22c55e', '#f59e0b', '#ef4444', '#8b5cf6']

bars = ax.bar(x, means, width=0.6, color=colors, edgecolor='none', alpha=0.85)
ax.errorbar(x, means, yerr=errors, fmt='none', color='#374151', capsize=6, capthick=2, linewidth=2)

for i, v in enumerate(means):
    ax.text(i, v + errors[i] + 2, str(v), ha='center', color='#374151', fontsize=10, fontweight='500')

ax.set_xticks(x)
ax.set_xticklabels(groups, color='#374151', fontsize=10)
ax.set_ylabel('Score', color='#6b7280', fontsize=11)
ax.set_ylim(0, 90)

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color('#e5e7eb')
ax.spines['bottom'].set_color('#e5e7eb')
ax.tick_params(axis='both', colors='#6b7280', labelsize=9)
ax.yaxis.grid(True, color='#f3f4f6', linewidth=1)
ax.set_axisbelow(True)

ax.set_title('Group Performance with Variance', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support