Data Visualization — Charts That Tell Truth
What you'll learn
- Why a chart beats a table of numbers
- Which chart type for which question
- How charts mislead (and how to be honest)
- The tools: matplotlib, seaborn, and beyond
A picture worth a thousand rows 📈
You can stare at 10,000 numbers and see nothing. Put them in a chart and a pattern jumps out instantly. Data visualization is how analysis becomes insight a human can act on — and how you communicate findings to a boss who won't read your spreadsheet.
Pick the chart for the question:
- Bar chart — compare categories. "Sales per region." Different things, side by side.
- Line chart — show change over time. "Revenue by month." Anything with a timeline.
- Scatter plot — reveal a relationship between two numbers. "Does study time relate to test score?" Each dot is one observation.
- Histogram — show the distribution/spread of one variable. "How are ages spread?" (remember spread from the statistics lesson?)
- Pie chart — parts of a whole. Use sparingly; bars are usually clearer.
The golden rule: don't lie with charts. The classic trick is a truncated y-axis — starting a bar chart at 90 instead of 0 makes a tiny 2% difference look enormous. Honest charts usually start the axis at zero, use clear labels, and don't cherry-pick a flattering time range. As a data scientist your credibility is your product; a misleading chart destroys trust.
The tools: in Python, matplotlib is the foundational plotting library, seaborn makes prettier statistical charts with less code, and Plotly makes interactive ones. For business dashboards, Tableau and Power BI (next lessons) let non-coders explore data visually.
import matplotlib.pyplot as plt
plt.bar(["A", "B", "C"], [10, 25, 15])
plt.title("Sales by product")
plt.show() # a chart appears
Color and clutter: the silent chart-wreckers 🎨
Chart type is only half the battle — even the right chart type can mislead or confuse through poor color and clutter choices.
Color rules that matter:
- Use color to encode meaning, not decoration. If every bar is a different random color for no reason, the reader wastes time hunting for a pattern that isn't there. Use one color for "our data," a second contrasting color only to highlight the one thing that matters (e.g., "this region is below target").
- Red/green alone excludes colorblind readers (~8% of men). Pair color with a label, shape, or pattern — never color alone to convey "good vs bad."
- Sequential data (low → high) needs a sequential color scale (light to dark of one hue), not a rainbow — a rainbow implies categories, not a smooth range.
Clutter rules:
- Remove gridlines, borders, and 3D effects that add no information. 3D bar charts in particular distort perceived height/depth — never use them for comparison.
- Every element should earn its place. If you can delete a legend, label, or line without losing meaning, delete it (a principle sometimes called "data-ink ratio" — maximize the ink that carries information, minimize the ink that doesn't).
- Order matters. Sort bar charts by value, not alphabetically, unless alphabetical order is itself meaningful — a sorted chart reveals rank at a glance.
The pattern across all of this: every visual choice should make the honest finding easier to see, never harder.
Before you even open matplotlib, practice picking the right chart. Write chart_for(question) — given a short lowercase string describing what's being asked, return the best chart type as a string: "bar", "line", "scatter", or "histogram".
Rules to implement:
- if the question contains
"over time"or"trend"→"line" - else if it contains
"relationship"or"correlat"→"scatter" - else if it contains
"distribution"or"spread"→"histogram" - else →
"bar"(default: comparing categories)
Real-world case study: the NASA Challenger O-ring chart 🔍
Before the Space Shuttle Challenger disaster in January 1986, engineers at Morton Thiokol were worried that cold temperatures would damage the rubber O-rings sealing the rocket boosters, and held a conference call the night before launch to argue against flying in the unusually cold forecast. They had the data to prove it — but the charts they faxed to NASA that night only plotted the launches where O-ring damage had occurred, sorted in a way that didn't clearly show temperature as the driver. Crucially, they left out the successful, undamaged launches, so the full pattern (damage got worse as temperature dropped) never popped visually. NASA management, unconvinced, approved the launch. The shuttle exploded 73 seconds after liftoff on an unusually cold morning, killing all seven crew members.
Statistician Edward Tufte later analyzed this disaster extensively in his writing on visualization, showing that a single, simple chart — all launches (not just the damaged ones) plotted with temperature on one axis and O-ring damage on the other — would have made the danger visually obvious even to a non-engineer.
It's one of the most sobering lessons in the entire field: a chart that omits the "boring" or "successful" data points can hide the exact pattern that matters most. Always plot the full picture, not just the exciting exceptions.
Question 1 of 5
You want to show revenue change over 12 months. Best chart?
Question 2 of 5
To compare sales across 5 regions, use a…
Question 3 of 5
How do bar charts most commonly mislead?
Question 4 of 5
Why is using red/green alone to mean 'bad/good' a problem?
Question 5 of 5
What was the key visualization failure before the Challenger disaster?
Summary
- Charts turn data into instant insight and communicate findings
- Match chart to question: bar (compare), line (time), scatter (relationship), histogram (distribution)
- Don't lie: start axes at zero, label clearly, don't cherry-pick
- Color should encode meaning (not decoration), and clutter (gridlines, 3D effects, unsorted bars) should be removed
- You coded a simple chart-type picker based on the question being asked
- The Challenger disaster shows how omitting "boring" data points can hide the pattern that matters most
- Tools: matplotlib, seaborn, Plotly; Tableau/Power BI for dashboards
Next: Machine Learning for data science — turning your clean, visualized data into predictions.
Practice
Reading is not learning until you run something. Pick one.