Why we draw data
Last updated
A mean, a standard deviation and a correlation squeeze a whole dataset into a few numbers. That's useful, and it throws almost everything away. In this lesson you'll meet four famous datasets with the same summaries and nothing else in common, watch one set of points take five shapes without its summaries moving, and see a store's bad week vanish inside an average. Then you'll draw your first chart, so you never have to trust the numbers alone.
By the end of this lesson you can
- Explain what a chart shows that summary numbers hide
- Describe Anscombe's quartet and why it was made
- Plot data before trusting its summaries
Anscombe's quartet
In 1973 the statistician Francis Anscombe published four small datasets, 11 points each, an and a . He made them up on purpose, to win an argument: that "numerical calculations are exact, but graphs are rough" was the wrong way round. Run the first two cells.
The first two cells summarise each set the way Stages 3 and 4 taught you: means, standard deviations (4.1), and the correlation , a number from −1 to 1 that says how closely the points follow a straight line (Stage 8 teaches it properly). All four sets agree: mean 9, mean 7.50, standard deviations 3.32 and 2.03, . Fit a straight line to any of them and you get the same line, too.
Now run the third cell. matplotlib is Python's charting library; the cell makes one figure with four charts and puts each set's points on one. You'll learn every line of it in the next lesson.
- Set I is what the summaries suggest: a cloud of points rising roughly along a line.
- Set II is a smooth curve. A straight line is the wrong model for it.
- Set III is a perfect line, plus one point far off it, which drags the summaries.
- Set IV is ten points stacked at , and one at . That single point makes the whole correlation.
Four different stories, one set of summaries. The numbers weren't wrong; they just couldn't tell you which story you had.
Same summaries, different data
Anscombe built his sets by hand. In 2017 Justin Matejka and George Fitzmaurice showed it can be done for almost any shape: move the points a tiny bit at a time, and keep a move only if the summaries are unchanged to two decimal places. Their "Datasaurus Dozen" includes a dinosaur. Here are five shapes made the same way for this course. Step through them, and watch the numbers on the right.
The summaries are the same in every frame, because they only measure where the middle is, how spread out the points are, and how straight they line up. They can't see a circle, a gap or a face. Your eyes can.
This is why every analysis in this course has a picture in it. Summaries are for reporting something you've already seen. A chart is for seeing it in the first place.
Wrong way: trusting the average
Two stores, two weeks of rice sales. The owner asks which store had the better fortnight. Run the first cell.
Both average exactly 30.0 kg a day. It's tempting to write "the two stores did the same" and move on.
The second cell draws each day. Lipa is steady, between 28 and 32 kg. Rosario sells more, 36 to 40 kg on a normal day, but sold nothing for three days in a row. It was shut, and the extra on the other eleven days happens to fill exactly the hole.
Those are two very different fortnights: one store that's reliable, and one that's busier but closed for three days, which the owner needs to know about. The third cell shows that the full summary would have hinted at it (a minimum of 0, a median of 38 against a mean of 30), but only if you looked for it. The chart shows it without being asked.
The habit: before you report a summary, plot what it summarises. It takes one cell.
Check what you learned
Sources
Every example on this page was run with Python 3.14, and its output and error messages are copied from it. These pages cover the same ground in more depth.
- Anscombe, Graphs in Statistical Analysis, The American Statistician 27(1), 1973: the quartet, and the case for drawing data
- Matejka and Fitzmaurice, Same Stats, Different Graphs, CHI 2017: the Datasaurus Dozen: datasets nudged into shapes while their summaries stay fixed
- Hunter, Matplotlib: A 2D Graphics Environment, Computing in Science & Engineering 9(3), 2007: the library this stage uses
- matplotlib: Quick start guide: figures, axes and the first plot