Error Bar Chart
Cement Strength Development
Portland cement compressive strength gain over curing time for different cement types.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
# Cement testing data
days = np.array([3, 7, 14, 28, 56, 90])
type_i = np.array([18, 28, 35, 42, 48, 52])
type_ii = np.array([15, 24, 32, 40, 47, 51])
type_iii = np.array([25, 35, 40, 45, 49, 52])
err_i = np.array([2, 2.5, 3, 3, 2.5, 2])
err_ii = np.array([1.8, 2.2, 2.8, 2.8, 2.4, 2])
err_iii = np.array([2.5, 3, 3.2, 3, 2.6, 2.2])
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
ax.errorbar(days, type_i, yerr=err_i, fmt='o-', color='#4927F5',
ecolor='#4927F5', elinewidth=2, capsize=5, markersize=10,
markeredgecolor='#1f2937', linewidth=2.5, label='Type I (General)', alpha=0.9)
ax.errorbar(days, type_ii, yerr=err_ii, fmt='s-', color='#27D3F5',
ecolor='#27D3F5', elinewidth=2, capsize=5, markersize=9,
markeredgecolor='#1f2937', linewidth=2.5, label='Type II (Moderate)', alpha=0.9)
ax.errorbar(days, type_iii, yerr=err_iii, fmt='^-', color='#F54927',
ecolor='#F54927', elinewidth=2, capsize=5, markersize=10,
markeredgecolor='#1f2937', linewidth=2.5, label='Type III (High Early)', alpha=0.9)
ax.axhline(y=40, color='#6CF527', linestyle='--', linewidth=1.5,
label='28-day Spec (40 MPa)', alpha=0.7)
ax.set_xlabel('Curing Time (days)', fontsize=11, color='#374151', fontweight='500')
ax.set_ylabel('Compressive Strength (MPa)', fontsize=11, color='#374151', fontweight='500')
ax.set_title('Portland Cement Strength Development', fontsize=14,
color='#1f2937', fontweight='bold', pad=15)
ax.legend(facecolor='#f8fafc', edgecolor='#d1d5db', fontsize=9)
ax.tick_params(colors='#6b7280', labelsize=9)
ax.set_xlim(0, 100)
ax.set_ylim(10, 60)
ax.grid(True, alpha=0.3, color='#d1d5db')
for spine in ax.spines.values():
spine.set_color('#d1d5db')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Error Bar Chart examples
☕