Error Bar Chart

E-commerce Device Conversion Funnel

Conversion funnel analysis across different device types showing drop-off rates.

Output
E-commerce Device Conversion Funnel
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)

stages = ['Visit', 'Product\nView', 'Add to\nCart', 'Checkout', 'Purchase']
desktop = np.array([100, 45, 18, 12, 8.5])
mobile = np.array([100, 52, 22, 10, 5.2])
tablet = np.array([100, 48, 20, 11, 6.8])
desktop_err = np.array([0, 4, 2, 1.5, 1])
mobile_err = np.array([0, 5, 2.5, 1.2, 0.8])
tablet_err = np.array([0, 4.5, 2.2, 1.3, 0.9])

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

x = np.arange(len(stages))

ax.errorbar(x, desktop, yerr=desktop_err, fmt='o-', color='#4927F5',
            ecolor='#4927F5', elinewidth=2, capsize=5, markersize=12,
            markeredgecolor='#1f2937', linewidth=3, label='Desktop', alpha=0.9)

ax.errorbar(x, mobile, yerr=mobile_err, fmt='s-', color='#F5276C',
            ecolor='#F5276C', elinewidth=2, capsize=5, markersize=11,
            markeredgecolor='#1f2937', linewidth=3, label='Mobile', alpha=0.9)

ax.errorbar(x, tablet, yerr=tablet_err, fmt='^-', color='#6CF527',
            ecolor='#6CF527', elinewidth=2, capsize=5, markersize=11,
            markeredgecolor='#1f2937', linewidth=3, label='Tablet', alpha=0.9)

ax.set_xlabel('Funnel Stage', fontsize=12, color='#374151', fontweight='600')
ax.set_ylabel('Conversion Rate (%)', fontsize=12, color='#374151', fontweight='600')
ax.set_title('E-commerce Conversion Funnel by Device', fontsize=15, 
             color='#1f2937', fontweight='bold', pad=20)

ax.set_xticks(x)
ax.set_xticklabels(stages, fontsize=11)
ax.legend(facecolor='#ffffff', edgecolor='#e5e7eb', fontsize=11)
ax.tick_params(colors='#6b7280', labelsize=10)
ax.set_ylim(0, 110)
ax.grid(True, 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

Did this help you?

Support PyLucid to keep it free & growing

Support