Visualizing Data
A good picture shows you in a second what a table of numbers hides for an hour. The single most useful chart for one quantitative variable is the histogram. It comes with a hidden dial, the bin width, that can reveal a distribution's true shape or completely distort it.
What a histogram shows
A histogram chops the number line into equal-width bins and draws a bar for how many values land in each. Unlike a bar chart (which compares separate categories), a histogram's bars touch, because they cover a continuous range. At a glance it reveals the three things you most want to know about a distribution: its shape (symmetric and bell-like, skewed to one side, or with multiple peaks), its center (roughly where the values pile up), and its spread (tightly clustered or widely scattered, and whether any outliers are stranded out in the tails).
🎮 The Bin-Width Dial
Same data, different number of bins. Too few bins hides the shape; too many turns it into noise. Find the bin count that tells the truth.
The bin-width lesson: with only 2–3 bins, a two-peaked distribution looks like a single blob, its structure smoothed away. With 50+ bins, even bell-shaped data looks jagged and random. The right number of bins (often somewhere around 10–20 for a few hundred points) shows the real shape without inventing fake detail. Always try a couple of bin widths before you trust a histogram.
How wide should a bin be?
"Try a couple of widths" is honest advice, and it's also where most people stop. Statistics has three standard answers, and your plotting software has already picked one of them on your behalf, so it's worth knowing which:
- Sturges' rule counts bins instead of measuring them:
k = ⌈log₂ n⌉ + 1. It's the oldest of the three and assumes an idealized bell. - Scott's rule sets a width from the standard deviation:
h = 3.49 s / ∛n. - Freedman–Diaconis swaps that standard deviation for the interquartile range:
h = 2 × IQR / ∛n. Because the IQR ignores the tails, one wild value can't stretch every bin in the plot.
Run all three on the bell shape above (400 observations, SD near 13, spread across roughly 80 points of the scale) and they return 10, 13 and 17 bins. The dial's default of 12 sits inside that range, which is why the picture looks sensible before you touch anything. A fourth default you'll meet in spreadsheet software is the square-root rule, √n bins, which is cruder but rarely disastrous.
Now switch the shape to two peaks and run the rules again. Scott and Freedman–Diaconis both fall to 9 bins, fewer than they wanted for the bell, because the gap between the humps inflates the SD and the IQR alike. The rules measure spread; they can't see shape. Here the peaks are far enough apart to survive the coarser bins, but that's the data being kind, not the rule protecting you. No formula knows what you are looking for, which is the argument for moving the dial yourself.
Other workhorses
- Bar chart. For categorical data: one bar per category, with gaps between them (the categories aren't a continuum).
- Boxplot. The median, the quartiles, and whiskers reaching as far as the most extreme value still within 1.5 × IQR of the box. Anything beyond gets drawn as its own point, which is what makes a boxplot good at flagging outliers and at lining several groups up side by side. Every boxplot on this page takes its quartiles the way R and Python do, by interpolating between neighboring values; §1.3 sets that convention beside the textbook one you would use on paper, and the descriptives calculator will draw the box either way.
- Scatterplot. For two quantitative variables at once; the gateway to correlation and regression.
Which of the three you can even draw is settled by the variables in front of you. Count one categorical variable and a bar chart is the display. Split one quantitative variable by a categorical one and you get boxplots lined up side by side. Put two quantitative variables together and it is a scatterplot. The survey below carries all three kinds at once: a room of students, the revision method each of them leaned on, the hours they put in, and what they scored.
🎮 One Survey, Three Charts
The same students drawn three ways. Switch the chart, then use the checkbox to add the thing that display usually leaves out.
One categorical variable. Bar heights are counts of students, and the gaps say the four methods are separate things rather than points on a scale.
Every view keeps one thing and drops another. The bar chart counts students and says nothing about how any of them did. The boxplot compares the four groups, but it draws much the same box whether a group's scores gather around one value or split into two camps, which is the argument for switching the raw scores on. The scatterplot keeps every student on screen and hides the group comparison until you color the dots. Then walk the survey down to 16 students. Most of what you were confidently reading a moment ago stops being there.
Torn between them for a real dataset? The Which Chart Should I Use? chooser walks you to the right display in a few clicks. And when the picture is headed for a paper, Tables & Figures That Don't Lie shows how to keep it honest.
Why it matters: visualizing first is a discipline, not a decoration. The shape you see decides which summaries are honest (mean vs. median) and which tests are valid, so the picture always comes before the formula. Once you have looked, the test chooser turns what you saw into a shortlist.
Common questions
I only have 15 data points. Is a histogram still the right picture?
Sturges' rule asks for 5 bins at n = 15, and in 50,000 simulated samples drawn from a perfect bell, 62% of those histograms showed a dip with a taller bar on either side of it: a second peak that exists nowhere in the population. At n = 400 with 10 bins that false pattern appears 11% of the time, so at 15 the histogram is mostly reporting where the bin edges fell. Show every observation instead. A dot plot or strip plot puts one mark per value along the axis, and a boxplot with the raw points drawn over it gives you the summary and the evidence at once. Our descriptives calculator will also just list the numbers, which for 15 values is a perfectly respectable figure.
Why do people say never to use a pie chart?
Because pie charts make readers judge angles and areas, which humans do poorly — classic perception experiments (Cleveland & McGill, 1984) show we compare aligned bar lengths far more accurately. With more than two or three slices, "which is bigger?" becomes guesswork that a sorted bar chart answers instantly. The defensible pie is rare: a single part-of-whole message with two or three very different slices. Our chart chooser has a whole "resist the pie" verdict explaining the alternatives.
When should I use a boxplot instead of a histogram?
Use a boxplot when comparing several groups side by side (five boxplots fit neatly where five histograms would be a mess), or when you want outliers flagged automatically by the 1.5 × IQR rule. Use a histogram when the shape matters (skew, two peaks), because a boxplot can't show bimodality. Our descriptives calculator draws both from pasted data.