Choose a useful visualization
Match charts to questions, see why summaries alone can mislead, and avoid charts that distort.
- Pick a chart that matches the comparison you want to show
- Explain why you must plot data, not just summarize it
- Avoid common misleading chart designs
Pick the chart from the question:
| Question | Chart |
|---|---|
| How is one numeric variable distributed? | histogram, box plot |
| How do categories compare? | bar chart (sorted) |
| How do two numeric variables relate? | scatter plot |
| How does something change over time? | line chart |
| What share does each part have? | bar chart (pies only for 2-3 parts) |
In Python, matplotlib and seaborn draw these (df.plot.hist(), df.plot.scatter(x=..., y=...)). The code runner here shows text output, so the exercises draw charts with characters - the thinking is the same.
Try it
Up to 15 XPWhich chart?
Choose the best chart for each question.
“How long do most trips take?”
“Which station has the most departures?”
“Do longer trips cost more?”
“How did daily ridership change over the year?”
“Do warmer days have more riders?”
Same statistics, different stories
In 1973 the statistician Francis Anscombe built four small datasets with nearly identical means, variances, correlations and regression lines - and completely different shapes. In 2017 researchers at Autodesk took the idea further with the “Datasaurus Dozen”: a dinosaur and a dozen other drawings, all sharing the same summary statistics. The lesson: always plot your data.
Try it
Up to 15 XPAnscombe’s quartet
Compare the four rows of statistics. Then reveal the plots.
| Dataset | Mean x | Mean y | SD y | Correlation | Best-fit line |
|---|---|---|---|---|---|
| I | 9.00 | 7.50 | 2.03 | 0.82 | y = 0.50x + 3.00 |
| II | 9.00 | 7.50 | 2.03 | 0.82 | y = 0.50x + 3.00 |
| III | 9.00 | 7.50 | 2.03 | 0.82 | y = 0.50x + 3.00 |
| IV | 9.00 | 7.50 | 2.03 | 0.82 | y = 0.50x + 3.00 |
Before you look: from the numbers alone, would you guess these datasets look alike?
Key takeaways
Histogram for distributions, bars for categories, scatter for relationships, lines for time.
Identical summaries can hide completely different data - plot it.
Honest charts: labeled axes, bars from zero, no 3-D, enough context.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Practice: write Python
Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.
Build category counts
Read a JSON array of category strings. Print each distinct category and its count in alphabetical order, one per line as category count.
- Repeated labels
- One category
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Draw a text histogram
The first line is a bin width; the second a JSON array of numbers. Starting from the bin containing the minimum ((min // width) * width) up to the bin containing the maximum, print each bin as LOW-HIGH | ### (N), where HIGH = LOW + width − 1 and each # is one value.
- Width 10
- An empty bin
Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…