Error Bar Chart
Meditation App Clinical Study
Clinical study results comparing meditation app effectiveness across metrics.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
metrics = ['Anxiety\nReduction', 'Depression\nImprovement', 'Sleep\nQuality', 'Stress\nManagement', 'Mindfulness']
headspace = np.array([32, 28, 35, 38, 45])
calm = np.array([30, 25, 42, 35, 48])
waking_up = np.array([25, 35, 38, 32, 52])
err = np.array([6, 7, 5, 6, 5])
fig, ax = plt.subplots(figsize=(11, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
x = np.arange(len(metrics))
width = 0.25
ax.bar(x - width, headspace, width, yerr=err, label='Headspace',
color='#F5B027', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x, calm, width, yerr=err, label='Calm',
color='#27D3F5', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.bar(x + width, waking_up, width, yerr=err, label='Waking Up',
color='#6CF527', edgecolor='white', linewidth=1.5, capsize=4,
error_kw={'ecolor': '#374151', 'elinewidth': 1.5})
ax.axhline(y=30, color='#F5276C', linestyle='--', linewidth=2,
label='Clinical Threshold', alpha=0.7)
ax.set_xlabel('Metric', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Improvement (%)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('Meditation App Clinical Study', fontsize=15,
color='#1f2937', fontweight='bold', pad=20)
ax.set_xticks(x)
ax.set_xticklabels(metrics, fontsize=10)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=10, loc='upper right')
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(0, 65)
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
☕