Error Bar Chart
Material Tensile Strength Comparison
Engineering materials comparison showing tensile strength with standard deviation error bars for quality control.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
# Material testing data
materials = ['Steel\nAlloy', 'Titanium\nTi-6Al-4V', 'Aluminum\n7075', 'Carbon\nFiber', 'Inconel\n718']
tensile_strength = np.array([850, 1100, 570, 1600, 1375])
std_dev = np.array([45, 65, 35, 120, 55])
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
colors = ['#F54927', '#27D3F5', '#6CF527', '#F5276C', '#F5B027']
x_pos = np.arange(len(materials))
bars = ax.bar(x_pos, tensile_strength, yerr=std_dev, capsize=6,
color=colors, edgecolor='white', linewidth=1,
error_kw={'ecolor': 'white', 'elinewidth': 2, 'capthick': 2},
alpha=0.9, width=0.6)
# Add value labels
for bar, val, err in zip(bars, tensile_strength, std_dev):
ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + err + 30,
f'{val}±{err}', ha='center', va='bottom', color='white',
fontsize=9, fontweight='500')
ax.set_xlabel('Material Type', fontsize=11, color='white', fontweight='500')
ax.set_ylabel('Tensile Strength (MPa)', fontsize=11, color='white', fontweight='500')
ax.set_title('Material Tensile Strength Comparison', fontsize=14,
color='white', fontweight='bold', pad=15)
ax.set_xticks(x_pos)
ax.set_xticklabels(materials)
ax.tick_params(colors='#94a3b8', labelsize=9)
ax.set_ylim(0, 2000)
ax.grid(True, axis='y', alpha=0.2, color='#4a4a6a')
for spine in ax.spines.values():
spine.set_color('#333333')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Error Bar Chart examples
☕