Error Bar Chart
LED Light Spectrum Plant Growth
Indoor plant growth performance under different LED light spectrums.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
plants = ['Tomato', 'Lettuce', 'Basil', 'Pepper', 'Cannabis']
full_spectrum = np.array([95, 88, 92, 90, 98])
red_blue = np.array([85, 82, 88, 82, 92])
warm_white = np.array([70, 75, 72, 68, 75])
err = np.array([5, 6, 4, 5, 4])
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
x = np.arange(len(plants))
width = 0.25
ax.bar(x - width, full_spectrum, width, yerr=err, label='Full Spectrum LED',
color='#F5B027', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, red_blue, width, yerr=err, label='Red/Blue LED',
color='#5314E6', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, warm_white, width, yerr=err, label='Warm White LED',
color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.set_xlabel('Plant Type', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Growth Index (%)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('LED Light Spectrum Effect on Plant Growth', fontsize=15,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xticks(x)
ax.set_xticklabels(plants, fontsize=11)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(50, 110)
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
☕