Error Bar Chart
Skincare Ingredient Study
Clinical effectiveness of popular skincare ingredients across skin concerns.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
ingredients = ['Retinol', 'Vitamin C', 'Niacinamide', 'Hyaluronic\nAcid', 'Salicylic\nAcid']
anti_aging = np.array([92, 78, 65, 45, 35])
hydration = np.array([40, 55, 72, 95, 30])
acne = np.array([55, 42, 68, 25, 88])
err = np.array([8, 10, 7, 6, 9])
fig, ax = plt.subplots(figsize=(11, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
x = np.arange(len(ingredients))
width = 0.25
ax.bar(x - width, anti_aging, width, yerr=err, label='Anti-Aging',
color='#F5276C', edgecolor='white', linewidth=1.5, capsize=3,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, hydration, width, yerr=err, label='Hydration',
color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=3,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, acne, width, yerr=err, label='Acne Treatment',
color='#6CF527', edgecolor='white', linewidth=1.5, capsize=3,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.set_xlabel('Active Ingredient', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Effectiveness Score', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Skincare Ingredient Effectiveness Study', fontsize=15,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xticks(x)
ax.set_xticklabels(ingredients, fontsize=10)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(0, 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
☕