Choosing the Right Chart: Honest Visuals

Choosing the Right Chart: Honest Visuals in Python: You can now draw anything. This lesson is about what to draw — and it is the one that most changes how…

Concept Explanation

You can now draw anything. This lesson is about what to draw — and it is the one that most changes how people react to your work.

A chart is an argument. The encoding you choose determines what the reader concludes, and a technically correct chart can still mislead badly. The two questions to answer before writing any plotting code are:

  1. What is the question? Not "what data do I have" — what will the reader do differently depending on the answer?
  2. What kind of comparison does that question require?

The second question maps almost mechanically onto a chart type.

The Decision Table

Your questionChartWhy
How does this change over time?LineThe eye reads slope as rate of change
Which category is biggest?Bar (horizontal if labels are long)Length is the most accurately-read visual channel
How is one variable distributed?HistogramShows shape, skew, and gaps
How do several distributions compare?Box or violinMedian and spread side by side
Are these two variables related?ScatterReveals correlation, clusters, and outliers
What are the parts of a whole?Stacked bar (usually)Comparable across groups, unlike a pie
Where is this happening?Map / choroplethGeography is the comparison
How do many pairs relate?HeatmapA correlation matrix at a glance

How Accurately People Read Each Channel

Cleveland and McGill measured this. Ranked from most to least accurate:

  1. Position along a common scale (bars from a shared baseline, points on one axis)
  2. Position on separate scales (small multiples)
  3. Length
  4. Angle / slope
  5. Area
  6. Colour intensity
  7. Colour hue

This ranking is the reason a bar chart beats a pie chart for the same data: bars use position and length, pies use angle and area. It is also why encoding your most important variable in colour hue is usually a mistake.

The Honesty Rules

1. Bar charts must start at zero. The bar's length is the message. Truncating the axis multiplies the apparent difference:

y-axis 0-100:   A ▇▇▇▇▇▇▇▇  (82)     B ▇▇▇▇▇▇▇▇▇  (85)   -> "roughly equal"
y-axis 80-86:   A ▇▇        (82)     B ▇▇▇▇▇▇▇▇▇  (85)   -> "B is miles ahead"

Same data, opposite conclusion. Line charts may have a non-zero baseline, because their message is the slope rather than the length — but say so on the axis.

2. Do not use a dual y-axis to imply correlation. Two series on two scales can be made to look connected by choosing the scales. If you must, label both axes clearly and never present the crossing point as meaningful.

3. Aggregate honestly. An average hides a bimodal distribution completely. If the shape matters, show the distribution, not the mean.

4. Show uncertainty when it exists. A single line through noisy data implies a precision you do not have. Add a confidence band or plot the raw points behind it.

5. Pick colour maps that mean something.

DataColour mapExample
Sequential (low → high)viridis, BluesPopulation density
Diverging (around a midpoint)RdBu, coolwarmTemperature anomaly, profit/loss
Categorical (no order)tab10, Set2Region, product

Never use a rainbow map (jet) for continuous data — it invents boundaries that are not in the data, and it is unreadable for the ~8% of men with red-green colour blindness. viridis was designed specifically to fix both problems.

Chart Junk

Every element that does not carry information competes with the ones that do: 3-D effects on a 2-D quantity, heavy gridlines, drop shadows, a legend for a single series, decorative background images, and axis labels rotated to vertical. Delete them all and the data gets louder.


Code Example #1 (Basic)

The same numbers, two axes, two conclusions.

import matplotlib.pyplot as plt

teams = ["Alpha", "Bravo", "Charlie", "Delta"]
scores = [82, 85, 83, 86]

fig, (honest, misleading) = plt.subplots(1, 2, figsize=(11, 4))

honest.bar(teams, scores, color="steelblue")
honest.set_ylim(0, 100)                      # zero baseline
honest.set_title("Honest: y-axis starts at 0")
honest.set_ylabel("Score")

misleading.bar(teams, scores, color="indianred")
misleading.set_ylim(80, 87)                  # truncated -- the deception
misleading.set_title("Misleading: y-axis starts at 80")
misleading.set_ylabel("Score")

for ax in (honest, misleading):
    ax.spines[["top", "right"]].set_visible(False)

plt.tight_layout()
plt.savefig("baseline_matters.png", dpi=150)
print("A 4-point spread on a 100-point scale. Look at the right-hand chart.")

Nothing in the right-hand chart is factually false. Every bar is at its correct value. It is still a lie, because it exploits how the eye reads bar length.

Code Example #2 (Intermediate)

Answering four different questions about one dataset — with the right chart for each.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

rng = np.random.default_rng(11)

# Deliberately bimodal: two customer populations, not one
budget = rng.normal(28, 6, 400)
premium = rng.normal(74, 9, 260)

df = pd.DataFrame({
    "spend": np.concatenate([budget, premium]),
    "tier": ["Budget"] * 400 + ["Premium"] * 260,
    "visits": np.concatenate([
        rng.poisson(3, 400),
        rng.poisson(9, 260),
    ]),
})
df["spend"] = df["spend"].clip(lower=1).round(2)

fig, axes = plt.subplots(2, 2, figsize=(12, 8))
(a, b), (c, d) = axes

# Q1: "What is a typical spend?"  -> distribution, NOT a mean
a.hist(df["spend"], bins=45, color="steelblue", edgecolor="white")
a.axvline(df["spend"].mean(), color="crimson", linestyle="--",
          label=f"mean = {df['spend'].mean():.0f}")
a.set_title("Distribution reveals TWO groups")
a.set_xlabel("Spend (GBP)")
a.legend(frameon=False)

# Q2: "How do the tiers compare?" -> box plot
df.boxplot(column="spend", by="tier", ax=b, grid=False)
b.set_title("Spread by tier")
b.set_xlabel("")
b.set_ylabel("Spend (GBP)")
fig.suptitle("")

# Q3: "Do visits predict spend?" -> scatter
for tier, colour in [("Budget", "#4299e1"), ("Premium", "#dd6b20")]:
    sub = df[df["tier"] == tier]
    c.scatter(sub["visits"], sub["spend"], s=14, alpha=0.5,
              color=colour, label=tier)
c.set_title("Relationship between visits and spend")
c.set_xlabel("Visits per month")
c.set_ylabel("Spend (GBP)")
c.legend(frameon=False)

# Q4: "Which tier drives revenue?" -> horizontal bar, zero baseline
totals = df.groupby("tier")["spend"].sum().sort_values()
d.barh(totals.index, totals.values, color="seagreen")
d.set_xlim(0, totals.max() * 1.15)          # zero baseline, headroom for labels
d.bar_label(d.containers[0], fmt="%.0f", padding=4)
d.set_title("Total revenue by tier")
d.set_xlabel("Total spend (GBP)")

for ax in (a, b, c, d):
    ax.spines[["top", "right"]].set_visible(False)

plt.tight_layout()
plt.savefig("four_questions.png", dpi=150)

print(f"Mean spend: {df['spend'].mean():.2f}")
print("...which almost no individual customer actually spends.")

Panel A is the point of the whole example. The mean sits in the empty valley between two populations — a number that describes nobody. Any report quoting only "average spend: 46" would be technically accurate and completely uninformative.


Common Mistakes

  1. Truncating a bar chart's axis: the most common misleading chart in existence. Bars start at zero, always.
  2. Using a pie chart with more than three slices: nobody can rank 7% against 9% by angle. Use a sorted bar chart.
  3. Adding a third dimension: 3-D bars and exploded pies distort the very lengths and areas the reader is trying to compare.
  4. A rainbow colour map for continuous data: jet creates false edges and fails for colour-blind readers. Use viridis.
  5. Reporting a mean without checking the shape: bimodal, skewed, and outlier-heavy data all have means that describe no real observation.
  6. Encoding the key variable in hue: hue is the least accurately-read channel. Put your headline number on a position or length axis.
  7. Dual axes to suggest causation: choosing the two scales chooses the story. Two panels are more honest.
  8. Leaving default labels: spend on an axis instead of Spend (GBP). Units are not optional.
  9. Too many series on one line chart: past about five lines it becomes spaghetti. Facet into small multiples, or highlight one and grey the rest.
  10. Sorting categories alphabetically: sort by value. The reader wants the ranking, not the dictionary.

Best Practices

  • Write the question down before you write the code: "which region is underperforming?" tells you it is a sorted bar chart.
  • Sort categorical bars by value, not by name.
  • Prefer horizontal bars for long labels: no rotated text, no collisions.
  • Label directly when you can: text at the end of each line beats a legend the reader has to look back and forth to.
  • Use small multiples instead of a crowded single chart: the eye compares panels well.
  • Choose a colour map that matches the data type: sequential, diverging, or categorical — never a rainbow for continuous values.
  • Check your chart in greyscale: if it stops working, you have relied on hue alone. Add shape or pattern.
  • State the baseline when it is not zero: on a line chart, say so on the axis rather than hoping nobody checks.
  • Show the raw data when you have room: points behind a trend line, or a strip plot beside a box plot, keeps you honest about n and spread.
  • Give the chart a title that states the finding: "Premium customers drive 61% of revenue" is worth more than "Revenue by tier".

Practice Exercises

  1. The Two Versions: Take four values within 10% of each other and draw the same bar chart twice — once from zero, once truncated. Show both to someone without explanation and record which conclusion they reach.
  2. The Mean That Lies: Generate a bimodal distribution, print its mean, then plot the histogram with the mean marked. Write two sentences on what a report quoting only that mean would lead a reader to believe.
  3. The Chart Audit: Find three charts in a news article, blog post, or company report. For each, write down the question it answers, whether the chart type suits that question, and one specific change that would make it more honest or easier to read.