Area Chart

Checkout Funnel Analysis

User drop-off through e-commerce checkout stages

Output
Checkout Funnel Analysis
Python
import matplotlib.pyplot as plt
import numpy as np

stages = ['Cart', 'Shipping', 'Payment', 'Review', 'Complete']
users = [10000, 7200, 5400, 4100, 3200]
x = np.arange(len(stages))

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

# Flowing area
from scipy.interpolate import make_interp_spline
x_smooth = np.linspace(0, len(stages)-1, 100)
spl = make_interp_spline(x, users, k=2)
users_smooth = spl(x_smooth)

ax.fill_between(x_smooth, 0, users_smooth, alpha=0.6, color='#27D3F5')
ax.plot(x_smooth, users_smooth, color='#27D3F5', linewidth=3)
ax.scatter(x, users, color='#F5276C', s=100, zorder=5, edgecolors='white', linewidth=2)

# Conversion rates
for i in range(len(stages)):
    ax.text(i, users[i] + 400, f'{users[i]:,}', ha='center', fontsize=10, color='#1f2937', fontweight='bold')
    if i > 0:
        rate = users[i] / users[i-1] * 100
        ax.text(i - 0.5, (users[i] + users[i-1])/2, f'{rate:.0f}%', ha='center', fontsize=9, color='#6CF527')

ax.set_xticks(x)
ax.set_xticklabels(stages)
ax.set_ylabel('Users', color='#1f2937', fontsize=11)
ax.set_title('Checkout Funnel Conversion', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#374151', labelsize=10)
for spine in ax.spines.values():
    spine.set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.set_ylim(0, 12000)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support