Track step-by-step drop-off with a funnel chart

Visualize

Track step-by-step drop-off with a funnel chart

Created: Last updated: Read time: 1 min

Funnel charts are great for showing drop-off between stages from entry to conversion. Trapezoids make remaining volume intuitive by width.

import numpy as np
import matplotlib.pyplot as plt

steps = ["Visit", "Product view", "Add to cart", "Payment info", "Purchase complete"]
counts = np.array([12000, 5400, 2600, 1800, 1250])
max_width = counts[0]

fig, ax = plt.subplots(figsize=(6, 4))
y_positions = np.arange(len(steps), 0, -1)
for idx, (step, count) in enumerate(zip(steps, counts)):
    width = count / max_width
    left = 0.5 - width / 2
    ax.fill_between(
        [left, left + width],
        [y_positions[idx]] * 2,
        [y_positions[idx] - 0.8] * 2,
        color=plt.cm.Blues(0.3 + idx * 0.12),
    )
    ax.text(
        0.5,
        y_positions[idx] - 0.4,
        f"{step}\n{count:,}",
        ha="center",
        va="center",
        color="white",
        fontsize=11,
    )

ax.set_xlim(0, 1)
ax.set_ylim(0, len(steps) + 0.5)
ax.axis("off")
ax.set_title("E-commerce purchase funnel drop-off")

conversion = counts[-1] / counts[0]
ax.text(0.02, 0.3, f"CVR: {conversion:.1%}", fontsize=11, fontweight="bold")

fig.tight_layout()

plt.show()

Trapezoid widths make drop-off easy to grasp.

Reading tips #

  • The width of each step represents remaining users; large gaps indicate bottlenecks.
  • Show CVR from top to bottom to make the impact clear.
  • Rename steps to match your product flow for easy reuse.