Visualize rank changes with a bump chart

Visualize

Visualize rank changes with a bump chart

Created: Last updated: Read time: 1 min

This bump chart connects quarterly sales ranks with lines. The key is to invert the y-axis so higher ranks sit at the top.

import numpy as np
import matplotlib.pyplot as plt

quarters = ["Q1", "Q2", "Q3", "Q4"]
brands = ["Alpha", "Bravo", "Charlie", "Delta", "Echo"]
ranks = np.array(
    [
        [1, 2, 3, 3],
        [3, 1, 1, 2],
        [2, 3, 2, 1],
        [4, 4, 5, 4],
        [5, 5, 4, 5],
    ]
)

fig, ax = plt.subplots(figsize=(7, 4))

for brand, rank in zip(brands, ranks):
    ax.plot(quarters, rank, marker="o", linewidth=2, label=brand)

ax.set_ylim(5.5, 0.5)
ax.set_ylabel("Rank")
ax.set_title("Sales rank by brand")
ax.grid(axis="y", alpha=0.2)
ax.legend(loc="upper right", bbox_to_anchor=(1.15, 1))

fig.tight_layout()

plt.show()

Inverting the y-axis makes rank changes easier to read.

Reading tips #

  • Since smaller ranks mean higher positions, inverting the axis makes the chart more intuitive.
  • Use line color and markers to distinguish brands, and place the legend on the right to avoid overlaps.
  • To highlight a specific brand, increase line width or adjust the color.