Error Bar Chart
Robot Vacuum Performance Test
Robot vacuum comparison for cleaning, navigation, and pet hair performance.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
vacuums = ['Roomba\nj7+', 'Roborock\nS8 Pro', 'Dreame\nL20', 'Ecovacs\nX2', 'Shark\nMatrix']
cleaning = np.array([92, 95, 90, 88, 85])
navigation = np.array([95, 92, 88, 90, 82])
pet_hair = np.array([90, 88, 85, 82, 92])
err = np.array([3, 3, 4, 4, 5])
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
x = np.arange(len(vacuums))
width = 0.25
ax.bar(x - width, cleaning, width, yerr=err, label='Cleaning Power',
color='#F5276C', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, navigation, width, yerr=err, label='Navigation',
color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, pet_hair, width, yerr=err, label='Pet Hair Pickup',
color='#6CF527', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.axhline(y=90, color='#F5B027', linestyle='--', linewidth=2, alpha=0.7)
ax.set_xlabel('Robot Vacuum', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Score', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Robot Vacuum Performance Comparison', fontsize=15,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xticks(x)
ax.set_xticklabels(vacuums, fontsize=9)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(70, 102)
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
☕