Data Visualization
Beginner 12 min read Data Visualization

Choosing the Right Chart

Question-driven chart grammar

The chart is the answer to the question: trends line/dot, comparisons bar/column, distribution hist/box, relationship scatter, part-whole stacked/bar. Match question to chart before aesthetics.

chart typetrendcomparisondistributionrelationshipcomposition
Before we start

What you will learn

  • Map the 5 question types to chart families
  • Swap between bar/line/box/scatter for the right grain
  • Avoid the pie/area traps for the wrong questions
Introduction

What is this?

Chart choice follows the analytical question, not the fashion: trend over time → line; compare categories → sorted bars; distribution → histogram/box/violin; relationship between numbers → scatter + trend; part of a whole → stacked bar or a single well-communicated proportion. Naming the question forces the fitting chart.

Motivation

Why do you need it?

  • The wrong chart type hides even true insight.
  • Knowing the five families lets you answer any stakeholder question instantly.
  • Consistent chart grammar makes reports read like one author.
  • Pre-commited chart types (pie whenever) silently damage credibility.
Think about it

Mental model

Imagine

Choosing the tool for each trade in a workshop

Think of

Chart selection

You don't use a hammer on a screw — and a line chart won't compare categories nor a pie show a trend. The needle, wrench, and calipers each measure a different thing; charts are the same set of trades.

Mechanics

How it works

  • Trend: line (many points) or column (few time buckets).
  • Comparison: sorted bar/column; dot plots for small labels.
  • Distribution: histogram, KDE, box, violin.
  • Relationship: scatter ± trend, hexbin for dense clouds.
  • Part-of-whole: stacked bar; single proportion as one labeled slice.
  • Prefer small multiples when a third dimension splits every chart.

Question → chart family.

Question
Data type
Family
Refine
Verify
Hands-on

Examples

The shape-matching one-liner

The shape-matching one-liner
import pandas as pd
q = {
"revenue over 12 months": "line with markers",
"plan revenue comparison": "sorted horizontal bars",
"spend distribution": "histogram or box",
"spend vs tenure link": "scatter + trend",
"share of each plan": "stacked bar or one labeled slice",
}
print(q)

Mapping questions to families first makes every chart a deliberate choice, not a reflex.

Real world

In production

  • A board KPI pack enforces 'trend → line, rank → bar' so every page reads instantly.
  • A support review picks box plots over means for queue-time comparisons by team.
  • A pricing study uses small-multiple scatters for price × demand × segment.
Guidelines

Best practices

  • Write the question as a comment before the charting code.
  • Prefer horizontal bars for long labels; vertical for time.
  • Add trend lines to scatters for direction; keep raw points visible.
  • When in doubt, sorted bar — it's auditable and honest.
Watch out

Common mistakes

  • Line charting categorical IDs — the x-axis invents a fake sequence.
  • Pie charts for a 15-slice product mix.
  • Area charts implying volume where only share exists.
  • Box plots to show trends (losing the chronology — use a ribbon/sparkline instead).
When things break

Debugging tips

  • A 'trend' chart that drifts oddly → check the x-axis is truly chronological.
  • Bars too similar to compare → labels direct or dot plot.
  • A scatter that reads as stripes → bin or jitter to expose density.
  • If a chart needs a paragraph to explain, the type is wrong.
Interviews

Interview checkpoint

Practice

Hands-on lab

Match Five Questions to Five Charts
25 min · beginner
In progress
Objectives
  • Classify questions into the five families
  • Produce one fitting chart per family
  • Justify each choice in one line

Match Five Questions to Five Charts

25 min · beginner

0/4 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

Best chart for spend vs tenure relationship:

2

A line chart is fine for comparing nominal categories.

Go deeper

Official documentation