Error Bar Chart
Manufacturing Process Control
Quality control chart showing batch measurements with variation and upper/lower control limits.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
# Manufacturing data - product dimensions
batches = np.arange(1, 13)
measurements = 50.0 + np.random.randn(12) * 0.3
std_devs = 0.1 + np.random.rand(12) * 0.15
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
# Control limits
ucl = 50.4
lcl = 49.6
target = 50.0
ax.axhline(y=target, color='#27D3F5', linestyle='-', linewidth=2, label='Target', alpha=0.8)
ax.axhline(y=ucl, color='#F5276C', linestyle='--', linewidth=1.5, label='UCL/LCL', alpha=0.8)
ax.axhline(y=lcl, color='#F5276C', linestyle='--', linewidth=1.5, alpha=0.8)
ax.fill_between(batches, lcl, ucl, color='#27F5B0', alpha=0.1)
# Color points by control status
colors = ['#6CF527' if lcl < m < ucl else '#F5276C' for m in measurements]
for i, (b, m, s, c) in enumerate(zip(batches, measurements, std_devs, colors)):
ax.errorbar(b, m, yerr=s, fmt='o', color=c, ecolor=c,
elinewidth=2, capsize=5, capthick=2, markersize=10,
markeredgecolor='white', markeredgewidth=1.5)
ax.plot(batches, measurements, '-', color='#94a3b8', linewidth=1, alpha=0.5)
ax.set_xlabel('Batch Number', fontsize=11, color='white', fontweight='500')
ax.set_ylabel('Dimension (mm)', fontsize=11, color='white', fontweight='500')
ax.set_title('Manufacturing Process Control Chart', fontsize=14,
color='white', fontweight='bold', pad=15)
ax.legend(facecolor='#1a1a2e', edgecolor='#333', labelcolor='white', fontsize=10, loc='upper right')
ax.tick_params(colors='#94a3b8', labelsize=9)
ax.set_xlim(0, 13)
ax.set_ylim(49.2, 50.8)
ax.grid(True, 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
☕