41 min read

> "There is no such thing as a good chart in the abstract. There are only good charts for specific questions."

Learning Objectives

  • Classify any dataset by its primary data types: categorical, continuous/quantitative, temporal, spatial, network/relational
  • Classify any analytical question by type: comparison, distribution, relationship/correlation, composition/part-to-whole, change over time, spatial pattern
  • Use the data type x question type matrix to identify candidate chart types
  • Apply a decision tree to narrow from candidate charts to the best choice for a specific context
  • Recognize the most common 'wrong chart' mistakes and their fixes (pie chart to bar, dual axis to small multiples, 3D bar to 2D bar)
  • Consider audience, medium, and context when making final chart selection

Chapter 5: Choosing the Right Chart: A Decision Framework for Any Data and Any Question

"There is no such thing as a good chart in the abstract. There are only good charts for specific questions." — This chapter's thesis, and from now on, your first question before every visualization.


You have made it through four chapters. You know why visualization matters (Chapter 1). You know how the eye processes visual information and which channels encode data most accurately (Chapter 2). You know how to use color without lying or excluding your audience (Chapter 3). You know the ethical lines between honest charts and deceptive ones (Chapter 4).

Now comes the question that every analyst faces at the start of every project, every analysis, every slide deck: What chart should I use?

This is the most practical question in data visualization, and it is the one that most practitioners answer by guessing. They open Excel or matplotlib, scroll through the chart picker, click whatever looks familiar, and move on. Maybe they always use bar charts because bar charts feel safe. Maybe they use pie charts because their manager likes pie charts. Maybe they use line charts for everything because a line chart is the first thing they learned.

The result is a world full of charts that technically display data but do not answer the question they were made to answer. A pie chart with seventeen slices that nobody can read. A spaghetti line chart with twelve overlapping series. A 3D bar chart that makes every value look more impressive than it is. A scatter plot where a line chart would have revealed the trend in a second. These are not rare mistakes. They are the default output of an analyst who has not internalized one simple idea:

The chart type is determined by the question, not by the data.

This chapter gives you a system for choosing the right chart every time. Not a gallery of pretty examples — a framework. Two inputs go in: the type of data you have and the type of question you are answering. One output comes out: a short list of chart types ranked by effectiveness for that specific combination. You then narrow the list using context — audience, medium, dataset size, and communication goal.

The framework is not proprietary. It synthesizes decades of visualization research from Cleveland, Tufte, Few, Wilke, and others into a single, usable artifact: the chart selection matrix. By the end of this chapter, you will have this matrix committed to memory (or printed on a card next to your monitor), and you will never again reach for a chart type by guessing.

No code in this chapter. We are still in Part I. The framework is library-agnostic — it works whether you implement it in matplotlib, seaborn, Plotly, Tableau, or hand-drawn on a whiteboard. When we reach Part III, you will implement every chart type we discuss here. For now, we think.


5.1 The Two Inputs: Data Type and Question Type

Every chart-selection decision begins with two questions:

  1. What kind of data do I have? (data type classification)
  2. What question am I trying to answer? (question type classification)

These are the two axes of the chart selection matrix that we will build in Section 5.4. If you can answer both questions clearly, the matrix gives you a short list of appropriate chart types. If you cannot answer both questions clearly, you are not ready to make a chart — you need to go back and clarify your data or your question first.

This two-input model is the threshold concept of the chapter. Most people choose charts by scrolling through a gallery: "Does this look like my data? Maybe. Let me try this one." That approach produces charts that display data without answering questions. The two-input approach forces you to articulate what you are trying to show before you decide how to show it.

Threshold Concept — Question Before Chart

You do not choose a chart based on what looks interesting or what tool you know best. You choose it based on what question you are answering. The same dataset can and should produce completely different charts depending on whether you are asking about comparison, distribution, relationship, composition, or change over time. The question narrows the options. The data type narrows them further. Context settles the choice.

Let us define each input precisely.


5.2 Classifying Your Data

Before you can choose a chart, you need to know what kind of data you are working with. This is not about file formats or database schemas — it is about the nature of the values in your columns. The classification system has five primary data types, and most real-world datasets contain a mix of several.

5.2.1 Categorical Data

Definition: Values that represent named groups or labels with no inherent numerical order. Also called nominal data.

Examples: - Product line names at Meridian Corp: Enterprise, Professional, Starter, Growth, Legacy - Disease names in the public health dataset: measles, tuberculosis, malaria, cholera, HIV/AIDS - Social media platforms: Facebook, Instagram, TikTok, YouTube, Twitter/X - Country names, department names, experimental condition labels

Key property: You can count categorical values and compare frequencies, but you cannot compute a meaningful mean, median, or standard deviation of the categories themselves. "The average of Enterprise and Starter" is meaningless. The order you list them in is arbitrary unless you impose one (alphabetical, by size, by importance).

What this means for charting: Categorical data maps naturally to the x-axis of a bar chart, to colors/shapes in a legend, or to the faceting dimension in small multiples. It does not map naturally to a continuous axis (you cannot interpolate between "Enterprise" and "Professional").

5.2.2 Continuous / Quantitative Data

Definition: Values that represent measurements on a numerical scale where the intervals between values are meaningful. Also called interval or ratio data, depending on whether a true zero exists.

Examples: - Temperature anomalies in the climate dataset: -0.42, +0.18, +1.07 degrees Celsius - Revenue figures at Meridian Corp: $14,200, $87,500, $1,245,000 - Vaccination rates in the public health dataset: 28%, 54%, 91% - Conversion rates in the social media dataset: 2.1%, 4.8%, 7.3%

Key property: You can compute meaningful arithmetic on continuous data — means, differences, ratios. The distance between 10 and 20 is the same as the distance between 90 and 100. You can interpolate between values (a temperature of 14.7 degrees is meaningful even if you never measured exactly 14.7).

What this means for charting: Continuous data maps naturally to positions on a numerical axis, to lengths (bar charts), to areas (bubble charts), or to color gradients (heatmaps). It is the most versatile data type for charting.

5.2.3 Temporal Data

Definition: Values that represent points in time or durations. Temporal data is technically a special case of continuous or ordered data, but it has unique properties that justify treating it as its own type.

Examples: - Date stamps in the climate dataset: 1880, 1921, 1973, 2024 - Order dates at Meridian Corp: 2022-01-15, 2022-03-22, 2024-11-08 - Weekly case counts in the public health dataset: Week 1, Week 2, ..., Week 52 - Timestamps in the social media dataset: 2024-06-15T09:42:17Z

Key property: Time has a natural, unambiguous order. It also has a natural connection between adjacent values — the temperature in March is related to the temperature in February in a way that temperature in one city is not related to temperature in another city. This connectivity is what makes line charts the default for temporal data: the line between two points implies continuity, and time really is continuous.

What this means for charting: Temporal data almost always goes on the x-axis (horizontal), with time flowing left to right (in cultures that read left to right). Line charts, area charts, and sparklines are native to temporal data. Bar charts can work for discrete time periods (quarterly revenue) but lose the implied continuity.

5.2.4 Spatial Data

Definition: Values associated with geographic locations — coordinates, regions, country codes, postal codes, addresses.

Examples: - Weather station coordinates in the climate dataset: latitude/longitude pairs - Sales region boundaries at Meridian Corp: North America, Europe, Asia-Pacific, Latin America - Country-level vaccination coverage in the public health dataset: ISO country codes - User locations in the social media dataset: city, country, continent

Key property: Spatial data has a two-dimensional structure (latitude and longitude) that carries meaning. Two data points that are geographically close may be related in ways that two geographically distant points are not. This spatial autocorrelation is invisible in standard charts but visible on maps.

What this means for charting: Spatial data calls for maps — choropleths, dot maps, hex-bin maps, cartograms. You can represent spatial data in non-map charts (a bar chart of values by country), but you lose the geographic relationships. Whether you need the spatial dimension depends on your question: "Which country has the highest vaccination rate?" does not need a map. "Is there a geographic cluster of low vaccination?" does.

5.2.5 Network / Relational Data

Definition: Data where the primary structure is connections between entities — who knows whom, what links to what, how things flow from one node to another.

Examples: - Supply chain relationships: factories, distributors, retailers, and the flows between them - Social media following relationships: which accounts follow which other accounts - Referral paths in the social media dataset: which pages lead to which other pages - Citation networks in academic research

Key property: The fundamental unit is not a single observation but a pair of observations (an edge). The structure of the whole network — clusters, hubs, bridges, isolated nodes — is the information.

What this means for charting: Network data requires specialized chart types: node-link diagrams, adjacency matrices, Sankey diagrams, chord diagrams. Standard charts (bar, line, scatter) cannot represent network structure. We will explore network visualization in depth in Chapter 24; for this chapter, we note where it fits in the classification and move on.

Applying the Classification to the Anchor Datasets

Let us practice the classification on all four anchor datasets:

Climate dataset: - Temperature anomaly: continuous - CO2 concentration: continuous - Sea level: continuous - Year/month: temporal - Station location: spatial

Corporate Sales (Meridian Corp): - Revenue, profit margin: continuous - Product line, region, sales rep: categorical - Order date: temporal - Region boundaries: spatial (if mapped)

Public Health: - Case rate, vaccination rate: continuous - Disease name, income group: categorical - Country-year: temporal + spatial - Country code: spatial

Social Media: - Conversion rate, session duration, page views: continuous - Channel, device type, page name: categorical - Event timestamp: temporal - User location: spatial (if available)

Notice that every real dataset is a mix of data types. The climate dataset is not "temporal data" — it is temporal, continuous, and spatial, depending on which columns you look at. This is why the data type classification is per-variable, not per-dataset. Your chart choice depends on which variables you are plotting for a specific question.

Check Your Understanding — Take any dataset you have worked with recently. For each column, classify it as categorical, continuous, temporal, spatial, or network. You will find that most datasets contain at least three of the five types.


5.3 Classifying Your Question

The second input to the framework is the type of question you are answering. This is where most analysts go wrong — they think about what data they have, but not about what they want the viewer to understand. Six question types cover the vast majority of analytical visualization needs.

5.3.1 Comparison

The question: "How does A compare to B (or to C, D, E...)?"

Examples: - "Which Meridian Corp product line generated the most revenue last quarter?" - "How do vaccination rates differ across income groups?" - "Which social media channel drives the most conversions?" - "How does 2024 temperature compare to the 1951-1980 average?"

What defines it: You are placing two or more items side by side and asking the viewer to judge relative magnitudes. The items might be categories (products, countries, departments) or might be the same thing at different times (this year vs. last year).

Signal chart types: Bar chart (vertical or horizontal), grouped bar chart, dot plot, lollipop chart, slope chart, small multiples.

5.3.2 Distribution

The question: "How are values spread out? What is the shape of this variable?"

Examples: - "What is the distribution of monthly temperature anomalies over the past century?" - "Are Meridian Corp deal sizes normally distributed, or skewed toward small deals?" - "What does the distribution of vaccination rates across all countries look like?" - "How are session durations distributed — are most visits short?"

What defines it: You are examining a single continuous variable (or comparing the distributions of the same variable across groups) and asking about its shape: center, spread, skewness, multimodality, outliers.

Signal chart types: Histogram, density plot (KDE), box plot, violin plot, strip/swarm plot, ECDF (empirical cumulative distribution function).

5.3.3 Relationship / Correlation

The question: "How do two (or more) variables relate to each other?"

Examples: - "Is there a relationship between CO2 concentration and global temperature?" - "Do Meridian Corp customers with higher contract values also have higher retention rates?" - "Is there a correlation between GDP per capita and vaccination coverage?" - "Do users who visit more pages convert at higher rates?"

What defines it: You are examining two continuous variables to see whether they co-vary — whether knowing one tells you something about the other. The relationship might be linear, curved, clustered, or nonexistent.

Signal chart types: Scatter plot, bubble chart, heatmap (correlation matrix), connected scatter plot, paired bar chart (for comparing two related measures).

5.3.4 Composition / Part-to-Whole

The question: "What are the parts, and how do they make up the whole?"

Examples: - "What share of Meridian Corp revenue comes from each product line?" - "What percentage of global disease burden comes from each disease category?" - "What fraction of social media traffic comes from each channel?" - "What is the breakdown of energy sources contributing to CO2 emissions?"

What defines it: You have a total, and you want to show how it breaks down into components. The parts should sum to 100% (or to a meaningful total). You are asking about proportions, not absolute values.

Signal chart types: Stacked bar chart (static composition), pie chart (very limited use), donut chart, treemap, waffle chart, stacked area chart (composition over time).

5.3.5 Change Over Time

The question: "How has this value changed over time? What is the trend?"

Examples: - "How has global temperature changed from 1880 to 2024?" - "What is Meridian Corp's quarterly revenue trend over the past three years?" - "How has measles vaccination coverage changed in Sub-Saharan Africa since 2000?" - "How have social media conversion rates trended month over month?"

What defines it: One axis is time. You are asking the viewer to perceive a trend, a cycle, a breakpoint, an acceleration, or a plateau. The question is fundamentally about change, not about the absolute values at any single point.

Signal chart types: Line chart, area chart, sparkline, small multiples (one panel per series), slope chart (two time points only), bar chart (discrete time periods).

5.3.6 Spatial Pattern

The question: "Is there a geographic pattern? Where are the high and low values?"

Examples: - "Which regions of the world are warming fastest?" - "Where are Meridian Corp's strongest and weakest sales territories?" - "Is there a geographic cluster of low vaccination coverage?" - "Which cities produce the most social media engagement?"

What defines it: The question is specifically about where — you are asking the viewer to perceive geographic patterns, clusters, outliers, or gradients. The spatial dimension is the point, not just a label.

Signal chart types: Choropleth map, dot/bubble map, hex-bin map, cartogram, small multiples by region.

The Question Comes First: A Demonstration

To see why question classification matters more than data classification, consider the climate dataset. It contains temperature anomalies, CO2 concentrations, and year columns. Here is the same dataset, four different questions, four different charts:

Question Question Type Best Chart Type
"How has temperature changed since 1880?" Change over time Line chart (year on x-axis, anomaly on y-axis)
"What is the distribution of annual temperature anomalies?" Distribution Histogram or density plot (anomaly on x-axis, frequency on y-axis)
"Is CO2 concentration correlated with temperature?" Relationship Scatter plot (CO2 on x-axis, temperature on y-axis)
"Which decade had the highest average temperature anomaly?" Comparison Bar chart (decade on x-axis, mean anomaly on y-axis)

Same dataset. Same columns. Four completely different charts. The chart type did not come from the data — it came from the question.

Check Your Understanding — Pick one of the other three anchor datasets (Meridian Corp, Public Health, or Social Media). Write four different questions about it, one for each question type (comparison, distribution, relationship, change over time). For each question, state which chart type you would use and why.


5.4 The Chart Selection Matrix

Now we combine both inputs into a single reference artifact: the chart selection matrix. This table maps every combination of data type and question type to the most appropriate chart types, ranked by effectiveness.

Read this table as follows: find your data type(s) in the leftmost column, then find your question type across the top. The cell where they intersect gives you a ranked list of chart types, with the strongest choice listed first. A chart listed in parentheses means it is acceptable but weaker than the alternatives.

The Matrix

Data Types Comparison Distribution Relationship Composition Change Over Time Spatial Pattern
1 Categorical Bar chart (horizontal preferred), Dot plot, Lollipop chart (Bar chart of counts) N/A — need 2 variables Pie chart (2-5 slices only), Donut chart, Waffle chart N/A — need time dimension N/A — need spatial dimension
1 Categorical + 1 Continuous Bar chart (sorted by value), Dot plot, Lollipop chart Histogram, Density (KDE), Box plot (one group) N/A — need 2 continuous Stacked bar (if categorical sums to whole), Treemap N/A — need time dimension Dot map (if categorical has locations)
2+ Categorical Grouped bar chart, Heatmap (categories x categories), Small multiples of bar charts Grouped box plot, Grouped violin (Mosaic plot, Balloon plot) Stacked bar chart (100%), Marimekko chart N/A — need time dimension (Choropleth if one categorical is geographic)
1 Continuous (Bar chart of binned values) Histogram, Density (KDE), ECDF, Rug plot N/A — need 2 variables N/A — need parts N/A — need time dimension N/A — need spatial dimension
2 Continuous Paired bar (if comparing 2 measures), Slope chart Overlapping histograms, Back-to-back histograms Scatter plot, Bubble chart (if 3rd continuous as size), Hexbin (large N) N/A — composition needs categories N/A — need time dimension Dot map (if coordinates are the 2 continuous)
3+ Continuous Small multiples, Parallel coordinates Small multiples of distributions Scatter plot matrix (pairplot), Correlogram heatmap N/A N/A — need time dimension N/A — need spatial dimension
1 Continuous + Time (Bar chart of period values), Slope chart (2 time points) Small multiples of distributions per period (Connected scatter plot) Stacked area chart Line chart, Area chart, Sparkline N/A — need spatial dimension
1 Categorical + 1 Continuous + Time Small multiples of line charts, Slope chart Small multiples of histograms per period N/A Stacked area chart (categories over time), 100% stacked area Multiple line chart (max 5-7 series), Small multiples N/A — need spatial dimension
Continuous + Spatial Bar chart by region (loses spatial), Small multiples by region Box plot by region Scatter plot (lat/lon or 2 measures per region) Treemap by region Small multiples of maps over time Choropleth, Graduated symbol map, Hex-bin map, Cartogram
Network / Relational (Bar chart of node degree) (Degree distribution histogram) Adjacency matrix, Node-link with encoding N/A Animated network, Small multiples of network snapshots Geographic network overlay

How to Read the Matrix: A Worked Example

Suppose you are working with the Meridian Corp dataset and your manager asks: "Show me how revenue breaks down by product line."

Step 1: Classify your data. You have one categorical variable (product line: 5 levels) and one continuous variable (revenue). Data types: 1 Categorical + 1 Continuous.

Step 2: Classify your question. The question asks about "breakdown" — how parts make up a whole. Question type: Composition.

Step 3: Find the cell. Row: "1 Categorical + 1 Continuous." Column: "Composition." Cell contents: "Stacked bar (if categorical sums to whole), Treemap."

Step 4: Evaluate candidates. A stacked bar chart works if you want to show revenue as a single bar divided by product line. A treemap works if you have many categories and want to show relative proportions through area. With only 5 product lines, the stacked bar is clearer. A simple bar chart sorted by revenue would also work and might be even better if the viewer needs to compare product lines to each other (which is comparison, not composition — notice how the question type shifts the choice).

Step 5: Consider context. This is for a manager. Keep it simple. A sorted horizontal bar chart with values labeled on the bars. Done.

Important Caveats About the Matrix

The matrix gives candidates, not commands. It narrows the field from dozens of chart types to two or three. Your judgment — informed by audience, medium, and context (Section 5.6) — makes the final selection.

Mixed data types are the norm. Real questions often involve multiple data types. "How does revenue by product line trend over the past 8 quarters?" involves categorical (product line) + continuous (revenue) + temporal (quarter). Start with the most important data type for the question, then use the matrix to find your starting point, and modify from there.

The matrix does not include every chart type. There are hundreds of specialized visualizations — funnel charts, Sankey diagrams, waterfall charts, radar/spider charts, bullet charts, Gantt charts. The matrix covers the 80% of situations you will encounter. The remaining 20% require specialized knowledge that we cover in later chapters (flow charts in Chapter 14, network charts in Chapter 24, time-series specializations in Chapter 25).

N/A cells are genuinely N/A. If the matrix says N/A, it means that combination of data type and question type either does not make sense or requires additional data. You cannot show "change over time" without a time variable. You cannot show a "spatial pattern" without spatial data. These are logical constraints, not limitations of the framework.


5.5 Common Wrong Choices and Their Fixes

The chart selection matrix helps you choose right. This section helps you recognize when you (or someone else) has chosen wrong. These are the six most common chart-type errors, why they happen, and what to do instead.

5.5.1 The Pie Chart With Too Many Slices

The mistake: A pie chart with more than five or six slices, often with tiny slivers labeled in 8-point font, sometimes with a legend that requires the viewer to match colors to labels.

Why it happens: Pie charts feel intuitive. "Show me the breakdown" triggers pie chart in most people's minds. And for two or three slices of obviously different sizes, a pie chart works fine. The problem is that it stops working well past about five slices, because the visual channel is angle and area — and as we learned in Chapter 2, both are low on the perceptual accuracy hierarchy. Comparing two 23% slices and two 19% slices is nearly impossible by eye.

The real problem: Pie charts encode data using angle and area, which rank below length and position on Cleveland and McGill's hierarchy. When slices are similar in size, viewers cannot accurately judge which is larger.

The fix: Use a bar chart. Sorted horizontally. The bar chart encodes the same data using length and position on a common scale — the two most accurate visual channels. Every comparison that was ambiguous in the pie chart becomes obvious in the bar chart. If you have more than seven or eight categories, consider grouping small categories into "Other" or using a treemap.

When a pie chart is actually acceptable: When you have two to three categories of obviously different sizes, and the point is the general proportion ("about two-thirds of our revenue comes from one product line"), not the precise comparison. Even then, a bar chart is at least as good.

5.5.2 The Dual-Axis Chart

The mistake: A chart with two y-axes — typically a line chart on the left axis and a bar chart on the right axis, with different scales. The two series appear to relate to each other visually, but the relationship is an artifact of how the axes were scaled.

Why it happens: An analyst wants to show two related metrics on one chart. Revenue and headcount. Temperature and CO2. Case count and vaccination rate. The two metrics have different units and different ranges, so "just put them on the same axis" does not work. The dual-axis trick seems to solve this.

The real problem: As we discussed in Chapter 4 on honest charts, dual-axis charts are deceptive by design. By choosing where to start each axis and how to scale it, you can make any two series appear correlated, inversely correlated, or unrelated. The visual relationship is determined by the axis scales, not by the data. A viewer who is not paying close attention to both axis labels will perceive a relationship that may not exist.

The fix: Two approaches, both superior:

  1. Small multiples. Put each series in its own panel, stacked vertically, sharing the x-axis (usually time). The viewer can see each series on its own scale and mentally compare the patterns. This is honest: each series has its own context, and no false visual correlation is introduced.

  2. Normalization. If you genuinely want to compare the patterns of two series (not their absolute values), normalize both to a common scale (e.g., z-scores or index to 100 at a baseline year). Then plot both on a single axis with a shared scale. This is honest because both series are on the same scale, and any visual alignment reflects real pattern similarity.

5.5.3 The 3D Bar Chart

The mistake: A bar chart rendered in three-dimensional perspective, with beveled edges, shadows, and an oblique viewing angle. Common in PowerPoint, Excel, and business presentations.

Why it happens: 3D looks "more professional" or "more impressive" to some viewers. Default settings in some tools make 3D easy to select.

The real problem: The 3D perspective distorts the very comparison the chart is supposed to enable. Bars in the back of the chart appear smaller than bars of the same value in the front. The oblique angle makes it impossible to read values accurately from the axis. The decorative rendering adds ink that carries no data (Chapter 6 will formalize this as wasted data-ink). As established in Chapter 2, the visual system processes 2D length comparisons with high accuracy — 3D perspective degrades that accuracy by introducing foreshortening, occlusion, and angle distortion.

The fix: Remove the third dimension. A flat, 2D bar chart with clean axis lines. No shadows. No bevels. No perspective. The resulting chart is easier to read, more honest, and more professional. If someone objects that it looks "boring," remind them that the purpose of a chart is to communicate data, not to decorate a slide.

5.5.4 The Spaghetti Chart

The mistake: A line chart with too many overlapping series — typically more than five or six lines on the same axes, often in colors that are hard to distinguish, crossing over each other repeatedly.

Why it happens: The analyst has data for many groups (ten countries, twelve products, twenty stocks) and wants to show them all. "Just put all the lines on one chart." As the number of series increases, the chart degrades: individual lines become impossible to trace, colors become indistinguishable (recall Chapter 3's seven-to-eight category limit for hue), and the chart communicates nothing except "there are a lot of lines."

The fix: Small multiples. Instead of overlaying twelve lines on one set of axes, create twelve small panels, each showing one line. Share the same x-axis and y-axis scale across all panels so they are directly comparable. The viewer can see the pattern of each series clearly and can compare across panels by glancing. If you need to show one particular series in context, use the highlight strategy: plot all lines in light gray and overlay the featured line in a bold color.

5.5.5 The Misleading Stacked Bar

The mistake: Using a stacked bar chart when the viewer needs to compare the individual segments (not the total, and not just the bottom segment). Because only the bottom segment shares a common baseline, all other segments are floating — their lengths are visually comparable but their positions are not, making accurate comparison nearly impossible.

Why it happens: The analyst wants to show both the total and the breakdown. The stacked bar seems to do both. It does — but it does neither well. The total is readable (the full bar length), and the bottom segment is readable (it starts at zero). All other segments float, and the viewer cannot accurately compare the lengths of floating segments across bars.

The fix: Depends on the question: - If the question is about totals: use a simple bar chart of totals. - If the question is about comparing segments: use a grouped bar chart (segments side by side for each category, all starting at zero) or small multiples. - If the question is about proportions: use a 100% stacked bar chart, which shows each bar as a percentage and makes within-bar proportions clear (though cross-bar comparison of middle segments is still hard).

5.5.6 The Wrong Chart for the Question

The mistake: A chart type that is technically valid for the data but wrong for the question. The most common instance: using a bar chart for temporal data when a line chart would be better.

Why it happens: The analyst does not distinguish between question types. A bar chart of quarterly revenue shows the data, but it does not emphasize the trend. The viewer sees discrete, disconnected bars and has to mentally connect them. A line chart, by contrast, connects the points — and the line's slope is a pre-attentive feature that immediately communicates whether values are rising, falling, or flat.

The fix: Go back to the question. If the question is "what is the trend over time?" use a line chart. If the question is "how does this quarter compare to other quarters?" use a bar chart. The data is the same; the question dictates the chart.

Check Your Understanding — Think about the last five charts you made or saw at work. Can you identify any of the six wrong-chart mistakes described above? What would the correct chart type have been?


5.6 Context Matters: Audience, Medium, and Purpose

The chart selection matrix and the common-mistakes checklist get you to a short list of two or three candidate chart types. To make the final choice, you need to consider three contextual factors that the matrix cannot capture.

5.6.1 Audience

Executive / Non-Technical Audience: - Prefer familiar chart types: bar charts, line charts, simple pie charts (2-3 slices). - Avoid unfamiliar types: violin plots, ECDF plots, parallel coordinates, Sankey diagrams. If the viewer has to learn a new chart type before they can understand the data, the chart has failed. - Emphasize the conclusion, not the data. An executive wants to know "revenue is up 12%" — not "here is the histogram of all quarterly revenue values." Annotation and titles do more work than the chart itself. - Keep the number of data points low. An executive dashboard with five key metrics is better than one with fifty.

Technical / Analyst Audience: - Can handle complex chart types: box plots, violin plots, scatter plot matrices, heatmaps. - Values precision over simplicity. Show confidence intervals, error bars, distribution shapes — the details that enable the viewer to form their own conclusions. - Expects interactivity if the medium supports it: hover for exact values, zoom, filter, drill-down.

General Public: - Assume no chart literacy beyond bar charts and line charts. - Use annotation aggressively — label the data directly rather than relying on axes and legends. - Avoid requiring the viewer to read a legend. If you must use color for categories, label the categories directly on the chart. - Prioritize the one takeaway over comprehensive data display.

5.6.2 Medium

Static Print (Paper, PDF, Poster): - No interactivity. Every insight must be visible in a single, fixed image. - Colorblind safety and grayscale readability are critical (recall Chapter 3). Many printed materials are photocopied in black and white. - Resolution matters. Small text and thin lines may be illegible in print. Test at actual output size. - Small multiples work exceptionally well in print — they use the large canvas of a page or poster to provide multiple views.

Screen / Digital (Slide Deck, Report, Blog): - Color is reliable (no grayscale risk, but colorblind safety still applies). - Space is limited — especially on slides. A chart on a slide must communicate in three to five seconds. Complexity kills. - Animation and transitions are possible but use them only when they add meaning (showing change over time, revealing data progressively).

Interactive Dashboard: - The viewer can explore. You do not need one chart to answer every question — provide multiple linked views. - Hover, zoom, filter, and drill-down let you support exploration at multiple levels of detail. - Initial view should still be clear without interaction. Design for the "first glance" and let interaction reveal depth.

5.6.3 Purpose

Exploratory (For Yourself): - Choose speed over polish. Default scatter plots, histograms, and box plots are fine. - The goal is to see patterns quickly. Chart aesthetics do not matter. - You may cycle through many chart types in rapid succession — the framework helps you cycle through the right types.

Explanatory (For an Audience): - Choose clarity over comprehensiveness. One chart, one message. Remove everything that does not serve that message. - The chart type should be the simplest one that answers the question. If a bar chart works, do not use a violin plot just because it shows more information. - Annotation, titles, and callouts do as much work as the chart geometry.

Confirmatory (For a Technical Report): - Choose precision over simplicity. Error bars, confidence intervals, statistical annotations. - Show the evidence, not just the conclusion. Distribution plots, scatter plots with regression lines, residual plots. - Reproducibility matters. Exact values, axis ranges, and data sources should be documented.


5.7 The Decision Tree: A Step-by-Step Algorithm

The matrix and the contextual factors can be combined into a single decision tree — a step-by-step algorithm that takes you from a blank canvas to a specific chart type. Here is the tree in text form. Follow it from Step 1. At each step, your answer narrows the options until you arrive at a chart type.

Step 1: What Is Your Question Type?

Ask yourself: "What do I want the viewer to understand?"

  • If comparison (how does A compare to B?): Go to Step 2A.
  • If distribution (what is the shape/spread of this variable?): Go to Step 2B.
  • If relationship (how do these two variables relate?): Go to Step 2C.
  • If composition (what are the parts of the whole?): Go to Step 2D.
  • If change over time (what is the trend?): Go to Step 2E.
  • If spatial pattern (where are the high/low values?): Go to Step 2F.

Step 2A: Comparison

  • How many items are you comparing?
  • 2 items: Paired bar chart or slope chart (if comparing change between two time points).
  • 3-15 items: Bar chart, sorted by value. Horizontal if labels are long. Dot plot if you want to minimize ink.
  • 15+ items: Lollipop chart (less ink than bars) or small multiples. Consider whether you can group or filter.
  • Are you comparing across groups AND across a second dimension?
  • Yes: Grouped bar chart (max 3-4 groups per cluster). If more, use small multiples.
  • Yes, and one dimension is time: Slope chart or small multiples of bar charts.
  • Go to Step 3 (Context Check).

Step 2B: Distribution

  • How many variables/groups?
  • 1 variable, 1 group: Histogram (for shape) or box plot (for summary statistics). Density plot if you prefer smooth curves.
  • 1 variable, 2-5 groups to compare: Overlapping density plots, side-by-side box plots, violin plots, or strip/swarm plots.
  • 1 variable, 6+ groups: Small multiples of histograms or ridge plot (stacked density plots).
  • Multiple variables: Scatter plot matrix (which is technically relationship, not distribution — reconsider your question).
  • How many data points?
  • Fewer than 30: Strip plot or swarm plot (show every point). Histograms may be too sparse.
  • 30-10,000: Histogram (choose bin width carefully) or density plot.
  • 10,000+: Density plot or ECDF (histograms with many bins can become noisy).
  • Go to Step 3 (Context Check).

Step 2C: Relationship

  • How many variables?
  • 2 continuous: Scatter plot. If more than ~1,000 points, consider hexbin or 2D density to handle overplotting.
  • 2 continuous + 1 categorical: Scatter plot with color or shape for the categorical variable (max 5-7 groups). Or small multiples (one scatter per group).
  • 2 continuous + 1 continuous (3 total): Bubble chart (3rd variable as bubble size). Use sparingly — area encoding is low-accuracy (Chapter 2).
  • Many continuous (4+): Scatter plot matrix (pairplot) or correlation heatmap for overview, then individual scatter plots for interesting pairs.
  • Go to Step 3 (Context Check).

Step 2D: Composition

  • How many parts?
  • 2-3 parts: Pie chart acceptable (but bar chart is still at least as good). Waffle chart for accessible proportions.
  • 4-6 parts: Stacked bar chart or treemap. Avoid pie charts — too many slices.
  • 7+ parts: Treemap (nested categories) or bar chart sorted by proportion with small categories grouped as "Other."
  • Does composition change over time?
  • Yes: Stacked area chart (if you want to show both the total and the parts) or 100% stacked area chart (if you only care about proportions).
  • No: Static stacked bar, treemap, or waffle chart.
  • Go to Step 3 (Context Check).

Step 2E: Change Over Time

  • How many series?
  • 1 series: Line chart. Period.
  • 2-5 series: Multiple lines on one chart (ensure color distinguishability per Chapter 3). Use direct labels instead of a legend.
  • 6+ series: Small multiples (one panel per series). Or the gray-plus-highlight strategy (all lines gray except the one you are discussing).
  • What is the time granularity?
  • Continuous (daily, hourly): Line chart or area chart.
  • Discrete periods (quarterly, annual): Bar chart acceptable, but line chart still works and better conveys trend.
  • Only two time points: Slope chart.
  • Do you need to show composition within the trend?
  • Yes: Stacked area chart (totals visible) or 100% stacked area chart (proportions visible).
  • No: Simple line chart.
  • Go to Step 3 (Context Check).

Step 2F: Spatial Pattern

  • Is your data at the regional/administrative level (countries, states, counties)?
  • Yes: Choropleth map (color-encoded regions). Ensure perceptually uniform palette (Chapter 3).
  • No, it is point data (coordinates): Dot map or graduated symbol map. If high density, hexbin map.
  • Do you also need to show change over time?
  • Yes: Small multiples of maps (one map per time period) or animated map (interactive only).
  • No: Static map with one palette.
  • Go to Step 3 (Context Check).

Step 3: Context Check

Before committing to a chart type, check:

  1. Audience: Does the audience know this chart type? If not, switch to a simpler type or add clear annotation explaining how to read it.
  2. Medium: Is this for print, screen, or interactive dashboard? Print demands simplicity and colorblind safety. Interactive allows complexity with progressive disclosure.
  3. Data size: If you have 100,000+ points, a basic scatter plot may overplot. Use hexbin, density, or aggregation.
  4. Number of categories: If your categorical variable has more than 7-8 levels, group, filter, or use small multiples instead of encoding everything in color.
  5. Ethical check: Does the chart type honestly represent the data? (Recall Chapter 4.) If you are using a truncated y-axis, an area chart that exaggerates magnitude, or any visual trick that would change the viewer's conclusion, reconsider.

If all checks pass, you have your chart type. Proceed to implementation.


5.8 When to Break the Rules

The framework in this chapter is a decision-support system, not a set of commandments. There are legitimate reasons to deviate from the matrix, and an advanced practitioner should know when and how.

Data Journalism and Narrative Visualization

Data journalists sometimes use unconventional chart types because they are writing for engagement as well as accuracy. A scrollytelling piece might use an animated connected scatter plot that would be confusing in a static business report but works brilliantly with guided narration. The New York Times election needle was a single gauge — a chart type that no decision matrix would recommend — but it was the right tool for communicating probabilistic uncertainty to an anxious audience in real time.

The key question when breaking the rules for narrative purposes: Does the unconventional choice serve comprehension, or does it just look novel? If the viewer understands the data better because of the unusual format — because the format is matched to the specific emotional and informational needs of the story — then break the rule. If the unconventional choice makes the viewer work harder without adding insight, stick with the standard.

Artistic and Exploratory Visualization

Some visualizations are works of art. Giorgia Lupi's "data humanism" approach creates elaborate hand-drawn data portraits that no decision matrix would generate. Nadieh Bremer's interactive visualizations use radial layouts, spiraling patterns, and bespoke visual metaphors. These are not wrong — they serve a different purpose. They invite contemplation rather than rapid comprehension. They make data beautiful in a way that sparks curiosity.

If your goal is art or exploration, the rules loosen. But understand which rules you are breaking and why. Even an artistic visualization should not mislead — it may sacrifice speed-of-reading for aesthetic impact, but it should not sacrifice honesty.

Novel Chart Types

New chart types are invented regularly. The violin plot, the beeswarm plot, the ridge plot, the Marimekko chart — all were novel at some point. If a novel chart type genuinely solves a communication problem that existing types do not, it may be worth the cost of requiring the viewer to learn something new. But that cost is real. Every unfamiliar chart type adds a learning tax. Use novel types when the payoff exceeds the tax, and always provide a "how to read this chart" annotation.

The Rule Behind the Rules

The decision framework is built on a single principle: match the visual encoding to the data structure and the analytical question. That principle is not a rule to break — it is the reason the rules exist. When you deviate from the specific recommendations in the matrix, you should still be following this underlying principle. You are choosing a different chart type because it matches your specific encoding needs better than the default recommendation does.


Chapter Summary

This chapter has given you a complete system for choosing the right chart type for any dataset and any question. The system has two inputs (data type and question type), one core artifact (the chart selection matrix), a refinement process (the decision tree), a library of common mistakes (wrong choices and their fixes), and a set of contextual adjustments (audience, medium, purpose).

The key ideas:

  1. The question comes first. Before you choose a chart, articulate the question you are answering. The same data demands different charts for different questions.

  2. Classify your data. Every variable is categorical, continuous, temporal, spatial, or network. Most datasets contain a mix.

  3. Classify your question. Six question types cover nearly every analytical scenario: comparison, distribution, relationship, composition, change over time, spatial pattern.

  4. Use the matrix. Data type x question type gives you a short list of candidates. The decision tree narrows the list.

  5. Avoid the common traps. Pie charts with too many slices, dual-axis charts, 3D bars, spaghetti charts, misleading stacked bars, and charts that do not match the question.

  6. Context settles the choice. Audience literacy, medium constraints (print/screen/interactive), purpose (exploratory/explanatory/confirmatory), and dataset size all influence the final selection.

  7. The framework is a guide, not a prison. Data journalism, artistic visualization, and novel chart types are legitimate departures — as long as the visual encoding still matches the data structure and the analytical question.


Progressive Project Checkpoint

Let us apply the framework to the climate dataset — the progressive project that will follow us through the entire book.

Question 1: "How has global temperature changed from 1880 to 2024?" - Data types: continuous (temperature anomaly) + temporal (year) - Question type: change over time - Matrix says: line chart - Decision tree confirms: 1 series, continuous time, no composition needed. Line chart.

Question 2: "What is the distribution of annual temperature anomalies?" - Data types: continuous (temperature anomaly) - Question type: distribution - Matrix says: histogram, density, ECDF - Decision tree confirms: 1 variable, 1 group, ~145 data points. Histogram or density plot.

Question 3: "Is CO2 concentration correlated with global temperature?" - Data types: continuous (CO2) + continuous (temperature) - Question type: relationship - Matrix says: scatter plot - Decision tree confirms: 2 continuous variables, moderate N. Scatter plot.

Question 4: "How do temperature anomalies differ across regions?" - Data types: continuous (temperature) + spatial (region) - Question type: comparison OR spatial pattern - Matrix says: choropleth (if spatial pattern is the focus), small multiples of line charts (if comparison is the focus) - Decision: if the audience needs to see where warming is happening, choropleth. If they need to compare specific regions to each other, small multiples.

The framework gave us four answers for four questions — all from the same dataset, all different chart types. We have not written a single line of code, and we already know exactly what we are going to build.

In Part II (Chapters 6-9), we will learn how to design these charts — how to strip clutter, add annotation, arrange panels, and build narrative. In Part III (Chapters 10-15), we will implement them in matplotlib. But the hardest decision — what to draw — is already made.


Spaced Review: Chapters 1-4

Before moving to Part II, test your retention of the foundational concepts from the first four chapters. These questions intentionally reach back to earlier material — retrieval practice strengthens memory.

  1. (Chapter 1) What is Anscombe's Quartet, and what does it demonstrate about the limits of summary statistics?

  2. (Chapter 2) Rank these visual channels from most to least perceptually accurate for quantitative data: area, position on a common scale, angle, length, color saturation.

  3. (Chapter 2) What is pre-attentive processing, and approximately how fast does it occur?

  4. (Chapter 3) Name the three dimensions of color and state which data type each is best suited to encode.

  5. (Chapter 3) Why does the rainbow (jet) colormap create false boundaries in continuous data?

  6. (Chapter 4) Give two examples of how a chart can technically show accurate data but still mislead the viewer.

  7. (Chapter 5 — this chapter) A colleague uses a pie chart with fourteen slices to show market share by country. What is wrong with this, and what chart type would you recommend instead?

  8. (Cross-chapter) You need to show how vaccination rates have changed over ten years across five countries. Walk through the decision framework: data types, question type, matrix lookup, and final chart recommendation.


What's Next

Part I is complete. You now understand why visualization works (perception science), how the eye processes visual information (pre-attentive processing, encoding hierarchy), how to use color honestly and accessibly (palette types, luminance-first principle), how to avoid deception (ethical chart design), and how to choose the right chart (the decision framework).

Part II shifts from science to craft. In Chapter 6, we will take the chart types you have learned to select and learn how to strip them of clutter — removing every drop of ink that does not serve the data. In Chapter 7, we will learn typography and annotation — how to add the right words to guide the viewer's eye. In Chapter 8, we will learn layout and small multiples — how to arrange multiple charts into a coherent visual argument. And in Chapter 9, we will learn storytelling with data — how to sequence charts into a narrative that persuades.

The question "what chart should I use?" is answered. The next question is: "how do I make it communicate?"


Continue to Exercises | Quiz | Case Study 1 | Case Study 2 | Key Takeaways | Further Reading