In this lesson
The Big Idea
A table full of numbers can hide exactly the thing you are looking for. Turn it into the right picture and the pattern jumps out in a second: the busiest hours, the strongest link, the odd outlier. That is data visualization. It has two jobs: helping you understand your own data, and helping you explain it to other people. But a chart on its own is not a message. You have to pick the chart that fits the data type and the question, then tell a clear, honest story your audience can follow.
Why Turn Numbers into Charts?
Data visualization means representing data as charts or shapes so that the eye can pick up features that are hard to read from the numbers alone: the overall trend, how values are spread, and outliers.
Visualization does two jobs:
| Role | What it means | Example | |---|---|---| | Deepening the analyst's own understanding | You see the distribution, trends and outliers yourself and get new insights | You log your daily study time for a month. In a table the numbers look alike, but a line chart shows that you dip every Thursday | | Communicating data to others | You present results and conclusions, with the evidence behind them, in a way the audience understands | A bar chart of the average test score per class lets even a first-time viewer compare the classes in a second |
The first job usually happens before you know the answer: you are exploring. The second happens after: you are explaining and persuading.
How Do You Choose the Right Chart?
Before you draw, ask: what do I want the reader to see? A comparison? A change? A relationship? A pattern across a grid? Then pick the chart that answers that question:
- Bar chart: compares categories, such as the average score of each class, or sales of each item at the canteen.
- Line chart: shows change over time or over an order, such as temperature day by day, or your study hours week by week.
- Scatter plot: shows the relationship between two quantitative variables, such as study time and test score; each student is one dot.
- Heatmap: shows a numeric value for every cell of a grid, with a legend explaining the colours.
- Mosaic plot: shows counts or shares of the combinations of two categorical variables using rectangle areas.
There is no "number of variables" rule
You may hear that "common charts are for one or two variables, while heatmaps and mosaic plots are for three or more." The Arabic edition of the book corrects this explicitly: no rule links the chart type to the number of variables alone. A heatmap does contain three things (row, column and a value shown as colour), but you choose it because you have a value for every cell of a grid, not because you counted three variables. A mosaic plot shows only two categorical variables, yet it is not an "ordinary" chart.
Heatmaps: Colour Tells the Value
A heatmap is a grid (or matrix) of cells in which the colour of each cell represents a numeric value, together with a legend that explains each colour. The rows are one category, the columns are another, and the colour is the amount where they meet. One of the book's examples: the average temperature of each city in each month, when the goal is to compare the pattern of values across the whole grid.
Example: when is the shop busy?
The book's example: the number of customers in a shop by time of day (6 times) and day of the week (7 days), which is 42 numbers. Reading them in a table is tiring; in a heatmap the dark areas jump out at once.
What does the grid tell you? (Day names follow the Arabic edition; see the note below.)
- Busiest days: the Friday column (total 462 customers), then Saturday (366). Sunday to Thursday range from 163 to 264.
- Busiest times of day: 18:00 (row total 468), then 12:00 (418). The quietest time is 10:00 (140).
- Busiest single cell: Friday at 18:00, with 110 customers.
The shop owner can act straight away: more staff on Friday and Saturday, especially at midday and in the evening.
The overplotting problem
A scatter plot is mainly for the relationship between two quantitative variables. But imagine a big school with thousands of students, and you plot study time against score for every one of them. The dots pile on top of each other into a solid blob, and you can no longer see where most students are. This is overplotting: points overlap so much that the density disappears.
The fixes the book mentions, depending on the case:
- Transparency: make each dot partly see-through, so crowded areas look darker.
- Binning: split the area into small squares and count the dots in each.
- A 2-D density display: show where the dots concentrate instead of every single dot.
The Arabic edition adds that a general heatmap suits data with a value for each cell or region, and is not an automatic fix for every case of overplotting.
Mosaic Plots: Area Tells the Share
First: cross-tabulation
When you have two categorical variables, such as gender (male/female) and favourite subject (maths, science, …), you usually start with cross-tabulation: a table that counts the cases for every combination of categories, such as "how many boys prefer maths?" and "how many girls prefer science?".
Second: how a mosaic plot is built
A mosaic plot shows the counts or shares of the combinations of two categorical variables using rectangle areas. The clearest way to read it:
- Column width = the group's share of all students. In the book's example males are 60% and females 40%, so the male column is wider.
- Rectangle height inside a column = the share within that group. 35% of males prefer maths, so the maths rectangle takes 35% of the male column's height. That is why each column adds up to 100%.
- Rectangle area = width × height = that combination's share of all students.
Let's work out some areas:
| Combination | Width | Height | Area (share of all students) | |---|---|---|---| | Male + Maths | 60% | 35% | 0.60 × 35% = 21% | | Female + Maths | 40% | 15% | 0.40 × 15% = 6% | | Male + Arabic | 60% | 20% | 0.60 × 20% = 12% | | Female + Arabic | 40% | 35% | 0.40 × 35% = 14% | | Male + English | 60% | 20% | 0.60 × 20% = 12% | | Female + English | 40% | 30% | 0.40 × 30% = 12% |
All eight areas add up to 100%. Notice the surprise in the last row: the share within females (30%) is bigger than within males (20%), yet the number of English fans is the same on both sides, because there are more males. In a school of 200 students, that is 24 boys and 24 girls who prefer English. The area shows this; the percentages alone don't.
The book also points out two things:
- Always state whether the chart shows counts or percentages, and how they were calculated.
- Stacked or proportional bar charts are sometimes clearer than a mosaic plot, depending on the question and the audience.
Misleading Graphs
A misleading graph is a chart whose design distorts the real pattern, even when the data itself is correct. Common forms:
- A truncated axis that doesn't start at zero in a bar chart, which blows up a small difference.
- A colour scale with no legend, or a colour scale that doesn't start at zero so small differences look huge.
- Truncated or missing categories with no note.
- Hidden labels: a vague title, axes with no names or units, or no source.
- A chart that doesn't fit the data, such as a line joining classes that have no natural order, suggesting a trend that isn't there.
In the misleading chart the axis starts at 70, so Class A's bar is 72 − 70 = 2 units tall and Class B's is 75 − 70 = 5 units, making it look 2.5 times taller. In reality 75 is only about 4% more than 72. Nobody lied about a number, yet the reader got the wrong message.
Data Storytelling: From Chart to Message
Data storytelling means organising the presentation of data around a clear question or result, while keeping the context and information the reader needs to understand the data, and not hiding anything that could change the interpretation.
It has three key elements:
| Element | Meaning | Example | |---|---|---| | Clarifying the message | You can say in one sentence what the chart is meant to convey | A title like "Class 2/3 had the highest average in the maths test" instead of "Test results" | | Selecting elements | Remove what doesn't serve the message and highlight the important part | Colour the class you're talking about in a bright colour and the others in a muted colour that is still readable, without hiding context or contrary evidence | | Providing supporting information | A clear title, axis names and units, the source and period, and a scale definition or method note where needed | "Score" on the vertical axis, "Class" on the horizontal axis, "Source: first-term mark sheets" |
When the chart is done, put yourself in the audience's shoes: if a classmate saw it for the first time, could they say your message in one sentence? The same result can be understood very differently depending on how it is presented.
Try It Yourself
Common Mistakes
"I choose the chart by the number of variables only"
The count alone isn't enough. Two variables may need a scatter plot (if both are quantitative) or a mosaic plot (if both are categorical).
Choose the chart by data type, question, audience and kind of comparison.
"The more elements in a chart, the more useful it is"
Clutter hides the pattern and distracts from the message.
Remove what doesn't serve the message and highlight what matters, while keeping context, labels and the source.
"In a mosaic plot, the number inside a rectangle is its share of all students"
In the book's example that number is the share within the group, which is the rectangle's height; that is why each column adds up to 100%.
Area = column width × height. Male–maths: 0.60 × 35% = 21% of all students.
"If the numbers are right, the chart can't mislead"
A truncated axis, a colour scale with no legend, or unlabelled axes all create a false impression from correct numbers.
An honest chart means an honest scale, labels and context, not just correct numbers.
"A heatmap automatically fixes any overplotting"
A general heatmap suits data with a value for every cell or region.
For overlapping dots, try transparency, binning or a 2-D density display, depending on the case.
Key Points
- Data visualization turns numbers into charts that reveal trends, spread and outliers. It has two roles: deepening the analyst's understanding and communicating results to others.
- Chart choice depends on data type, question, audience and comparison, not on the number of variables alone.
- Bars compare categories, lines show change over time or order, and scatter plots show the relationship between two quantitative variables.
- A heatmap is a grid where colour represents each cell's value; it is incomplete without a legend.
- A mosaic plot shows combinations of two categorical variables by area: width is the group's share, height is the share within it, and area is the share of everyone.
- Overplotting hides density; fixes include transparency, binning and density displays.
- A misleading graph distorts the pattern even with correct data: a truncated axis, a scale without a legend, hidden labels.
- Data storytelling: one-sentence message, elements that serve it, honest supporting information, then check that the audience got it.
FAQ
What is the difference between a heatmap and a mosaic plot?
A heatmap shows a numeric value for each cell of a grid using colour, such as the number of customers for each day and hour. A mosaic plot shows counts or shares of the combinations of two categorical variables using rectangle areas, such as gender and favourite subject. In the first you read colour; in the second you read area.
How do I work out the area of a rectangle in a mosaic plot?
Multiply the column width (the group's share of everyone) by the rectangle's height (the share within the group). For example, males are 60% and 35% of them prefer maths, so the area is 0.60 × 35% = 21% of all students.
Must an axis always start at zero?
For bar charts, usually yes, because a bar's length is read as an amount and a truncated axis exaggerates differences. If another chart really needs a different range, state the scale clearly so the reader doesn't get an impression the data doesn't support.
What matters most in data storytelling?
Having one clear message you can say in a sentence, choosing the elements that serve it, and adding the title, axes, units and source, without hiding anything that could change the interpretation. Finally, ask yourself whether the audience actually got the message.