Error Bar Chart
Home Espresso Machine Study
Espresso machine comparison for coffee quality, usability, and milk frothing.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
machines = ['Breville\nBarista', 'De\'Longhi\nLa Specialista', 'Gaggia\nClassic', 'Rancilio\nSilvia', 'Nespresso\nLatissima']
espresso_quality = np.array([92, 88, 95, 96, 72])
ease_of_use = np.array([85, 90, 68, 65, 98])
milk_frothing = np.array([90, 88, 75, 78, 85])
err = np.array([4, 5, 4, 5, 3])
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
x = np.arange(len(machines))
width = 0.25
ax.bar(x - width, espresso_quality, width, yerr=err, label='Espresso Quality',
color='#9C2007', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, ease_of_use, width, yerr=err, label='Ease of Use',
color='#F5B027', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, milk_frothing, width, yerr=err, label='Milk Frothing',
color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.axhline(y=85, color='#6CF527', linestyle='--', linewidth=2, alpha=0.7)
ax.set_xlabel('Espresso Machine', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Score', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Home Espresso Machine Comparison', fontsize=15,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xticks(x)
ax.set_xticklabels(machines, fontsize=9)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(50, 105)
ax.grid(True, axis='y', 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
More Error Bar Chart examples
☕