Skip to course content
Free data visualization course

Data Visualization and Dashboard Storytelling

Unit 04.02: Slope charts for before and after

A slope chart draws the change itself, rather than making the reader compute it.

The eye reads the angle

Three categories with a before and an after value, and the change between them.

The code lays them out.

BEFORE = {"Tuesday": 100, "Wednesday": 104, "Thursday": 98}
AFTER = {"Tuesday": 111, "Wednesday": 105, "Thursday": 97}

print(f"{'day':11} {'before':>7} {'after':>7} {'change':>8} slope")
for day in BEFORE:
    change = AFTER[day] - BEFORE[day]
    direction = "up" if change > 0 else ("flat" if change == 0 else "down")
    print(f"{day:11} {BEFORE[day]:>7} {AFTER[day]:>7} {change:>+8} {direction}")

print("""
A slope chart draws one line per category between two points. The eye reads
the ANGLE, so a category that moved differently from the others is visible
immediately -- which is exactly the "did the promotion work?" question.

Two grouped bar charts side by side make the reader compute the differences
themselves.
""")

Tuesday rose eleven while the comparable days barely moved. On a slope chart that is one line at an angle among two flat ones - visible before you have read a single number.

Two grouped bar charts side by side contain exactly the same information and make the reader do six subtractions and three comparisons in their head.

The mistake this prevents

The mistake is reaching for grouped bars because there are two time points. Grouped bars are for comparing categories within each period; slope charts are for comparing the *change* between periods, which is usually the question.

Takeaway

Use a slope chart when the change is the finding. Grouped bars make the reader compute the change; a slope chart draws it.