Error Bar Chart

Wine Critic Scores Comparison

Premium wine ratings from major critics with scoring variability analysis.

Output
Wine Critic Scores Comparison
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

# Wine scoring data
wines = ['Bordeaux\n2018', 'Burgundy\n2019', 'Napa Valley\n2020', 'Rioja\n2017', 'Barolo\n2018']
critic_a = np.array([94, 92, 90, 91, 95])
critic_b = np.array([92, 94, 88, 93, 93])
critic_c = np.array([93, 91, 91, 90, 94])
err = np.array([1.5, 1.8, 2.0, 1.6, 1.4])

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

x = np.arange(len(wines))
width = 0.25

ax.bar(x - width, critic_a, width, yerr=err, label='Wine Spectator',
       color='#9C2007', edgecolor='#1f2937', capsize=3,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, critic_b, width, yerr=err, label='Robert Parker',
       color='#C82909', edgecolor='#1f2937', capsize=3,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, critic_c, width, yerr=err, label='Decanter',
       color='#F5B027', edgecolor='#1f2937', capsize=3,
       error_kw={'ecolor': '#374151', 'elinewidth': 1.5})

ax.axhline(y=90, color='#6CF527', linestyle='--', linewidth=1.5, 
           label='Outstanding (90+)', alpha=0.7)

ax.set_xlabel('Wine', fontsize=11, color='#374151', fontweight='500')
ax.set_ylabel('Score (100-point scale)', fontsize=11, color='#374151', fontweight='500')
ax.set_title('Premium Wine Critic Scores Comparison', fontsize=14, 
             color='#1f2937', fontweight='bold', pad=15)

ax.set_xticks(x)
ax.set_xticklabels(wines)
ax.legend(facecolor='#f8fafc', edgecolor='#d1d5db', fontsize=9, loc='lower right')
ax.tick_params(colors='#6b7280', labelsize=9)
ax.set_ylim(82, 100)
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