STAT 200 · Statistics for Economics
Pictures of Data: Histograms, Bars and Scatter Plots
Choose the right chart for your data, build a histogram step by step, read a scatter plot, and spot pictures that mislead.
Key takeaways
- The right chart depends on the type of variable and on the question you are asking.
- A bar chart compares categories, while a histogram shows how the values of one quantitative variable are distributed.
- A scatter plot shows how two quantitative variables move together, one dot for each case.
- A line chart is the usual choice for a time series because it keeps dates in order.
- Cut-off axes, uneven intervals and cherry-picked date ranges can make true numbers tell a false story.
Theo runs a burrito truck. For twenty working days he has scribbled each day's sales on the back of a napkin: 42, 55, 61, 48, 73, 66, 58, 52, 69, 95, 45, 57, 63, 71, 54, 59, 64, 38, 77, 68.
Quick, how many burritos should he prep tomorrow? Is 73 a great day or a normal one? Stare at that string of numbers as long as you like. Your brain was not built to read it.
Now sort those days into a few groups and draw a bar for each. Within five seconds you will see that most days land between 50 and 70, and that one day was strangely huge. Nothing new was added to the data. It was just arranged so your eyes could do the work. That is what a good chart does, and a bad chart does the opposite with a straight face.
Start by counting: the frequency table
Last lesson sorted variables into categories and amounts, a split worth a quick look in data and variables if it is fuzzy. For either kind, a good first step is to count.
A frequency is the number of cases that fall in a group. A relative frequency is that count divided by the total number of cases, often written as a percentage. A table listing every group with its frequency is a frequency table.
Theo also notes which filling sold best each of the twenty days.
| Top filling | Days (frequency) | Share of days |
|---|---|---|
| Chicken | 9 | 45% |
| Beef | 6 | 30% |
| Beans | 4 | 20% |
| Fish | 1 | 5% |
The frequencies add to 20 and the shares add to 100%. Always check both. If they do not, a case went missing or got counted twice.
Bar charts: comparing categories
A bar chart draws one bar for each category, with height showing the frequency, share, or some other amount. The bars have gaps between them, a visual hint that chicken and beef are separate groups and not points along a number line.
Twenty working days at Theo's truck. Sorting bars from tallest to shortest makes ranking instant. Hypothetical example: the numbers are made up to show the method, not a quote or an average.
Some tips make bar charts easier to read. Sort nominal categories from biggest to smallest. Keep ordinal categories in their natural order (small, medium, large), even if that makes the bars jagged. And start the value axis at zero, for reasons you will see shortly.
What about pie charts? A pie shows parts of a whole, and it works when you have just a few slices that differ clearly. But people judge angles poorly. If two slices are 22% and 24%, a pie hides the difference and a bar chart shows it.
Histograms: the shape of one number
Theo's daily sales are quantitative, and almost every day has a different value. A bar for each value would look like a picket fence after a storm. Instead, cut the number line into equal intervals called bins and count how many values land in each. The chart of those counts is a histogram.
Here is the recipe, worked on Theo's napkin.
First, find the smallest and largest values: 38 and 95. Second, pick a bin width that gives a handful of bins. A width of 10 works nicely, starting at 30. Third, decide where edge values go. A bin labeled "50 to 59" holds 50 through 59, and 60 starts the next one. Fourth, count.
30–39: 38 → 1 day
40–49: 42, 48, 45 → 3 days
50–59: 55, 58, 52, 57, 54, 59 → 6 days
60–69: 61, 66, 69, 63, 64, 68 → 6 days
70–79: 73, 71, 77 → 3 days
80–89: none → 0 days
90–99: 95 → 1 day
Total: 1 + 3 + 6 + 6 + 3 + 0 + 1 = 20 days Each bar is a bin of width 10. The empty bin is kept, because the gap is part of the story. Hypothetical example: the numbers are made up to show the method, not a quote or an average.
Now read it. The center sits around 60. Most days, 6 + 6 = 12 of 20, or 60%, fall from 50 to 69. The lone day at 95 sits far from the crowd. Maybe a concert let out nearby. A true histogram draws the bars touching, because the number line has no breaks, and it keeps the empty 80s bin so that the gap shows.
For planning, Theo might note that sales reached 80 or more on only 1 day in 20, or 5%. Prepping 95 every day would mean tossing a lot of tortillas.
Choosing bins
Bin width is your choice, and it changes the picture. With one giant bin of width 70, all 20 days pile into a single block that says nothing. With bins of width 1, you get a scattering of tiny spikes. Try a few widths. If a "pattern" appears with one width and vanishes with the next, do not trust it much.
Keep the widths equal when you can. If one bin is twice as wide as the others, it will tend to catch more cases and look important. When unequal bins are unavoidable, the honest method is to make the area of each bar, not its height, proportional to the count. Income tables with brackets of different sizes are a classic place where this matters.
Reading the shape
Once a histogram is drawn, describe it in a few plain words. Statisticians usually look at four things, and you can remember them as a short tour from the middle outward.
Center. Where is the middle of the pile? For Theo, somewhere around 60 burritos.
Spread. How far do the values stretch? His run from 38 to 95, a gap of 95 − 38 = 57 burritos, though most days sit in a much tighter band.
Shape. Is the histogram roughly symmetric, with the two sides looking like rough mirror images? Or does one side trail off in a long thin tail? A tail to the right, toward large values, is called right skew. Incomes tend to look like that. Does it have one peak or two? Two peaks hint that two different kinds of days, such as weekdays and festival days, are mixed together.
Oddities. Is anything far from the rest, or is there a surprising gap? The 95 is a candidate. An odd value is not automatically a mistake. It is a question to investigate. Theo should check his napkin, then check whether something happened that day.
Be modest with small data sets. Twenty days can produce a lumpy histogram by luck alone. Another twenty days would not give exactly the same bars, and sorting out real features from accidental ones is much of what the later lessons in this course are about.
Counts or shares?
If Theo wants to compare the 20 days at his truck with 200 days at a bigger truck, raw counts will mislead, since the bigger data set makes taller bars everywhere. Switch the vertical axis to relative frequency. His 50–59 bin becomes 6 ÷ 20 = 30%. If the other truck had 40 of its 200 days in that bin, its share would be 40 ÷ 200 = 20%, even though 40 days is far more than 6.
Scatter plots: two numbers at once
Theo suspects sunshine sells cold drinks. Now he has two quantitative variables for each day: hours of sunshine and drinks sold. A scatter plot puts one on each axis and draws one dot per day. By convention, the variable you think might do the explaining goes on the horizontal axis.
| Day | Sunshine (hours) | Drinks sold |
|---|---|---|
| 1 | 1 | 22 |
| 2 | 2 | 30 |
| 3 | 3 | 28 |
| 4 | 4 | 41 |
| 5 | 5 | 45 |
| 6 | 6 | 52 |
| 7 | 8 | 63 |
| 8 | 9 | 70 |
Each dot is one day. The cloud rises from lower left to upper right.
Ask three questions of any scatter plot. What is the direction: does the cloud rise, fall, or neither? What is the form: roughly a straight line, a curve, or separate clumps? How strong is it: are the dots tight around the pattern or sprayed all over? Here the direction is up, the form is close to a line, and the fit is fairly tight. The lesson on covariance and correlation turns that eyeball judgment into a number.
A rising cloud does not prove sunshine causes drink sales. Here it is a sensible story, but a picture alone cannot rule out other explanations.
A worked reading
Suppose Theo sees a new dot: a day with 7 hours of sunshine and only 25 drinks sold. Where would it land? Days with 6 hours sold 52 drinks, and days with 8 hours sold 63. A day in between would be expected to sell somewhere in the 50s. A value of 25 sits far below the cloud.
Notice something interesting. Neither number is strange on its own. Seven hours of sun is ordinary, and 25 drinks is within the range he has seen. It is the combination that is odd. Only a scatter plot shows that kind of surprise. Maybe the ice machine broke. A good analyst finds out before deleting anything, and says so openly if a point is removed.
A third variable can be folded in by using different colors or symbols, for example one for weekdays and one for weekends. Sometimes one blurry cloud turns out to be two tidy ones.
Line charts: watching time pass
For a time series, put time on the horizontal axis, plot each value, and connect the dots. The line makes trends, repeating seasonal patterns, and sudden breaks easy to see. Do not sort a time series by size. Putting months in order of sales would destroy the very thing you came to look at.
Economists often draw many such lines, and the slope tells the speed of change. If slopes feel rusty, the toolkit of graphs and slopes covers them.
A common mistake: the chopped axis
Theo's rival, Nina, posts a chart: "My sales crushed Theo's!" Her bar towers three times as high as his. The actual figures are 102 burritos for Nina and 98 for Theo.
How? Her value axis starts at 96 instead of zero. Her bar's visible height is 102 − 96 = 6. His is 98 − 96 = 2. The picture shows a ratio of 6 to 2, or 3 to 1. The truth is 102 ÷ 98 ≈ 1.04, about 4% more.
In a bar chart, length is the message, so bars should start at zero. Line charts and scatter plots show position and may start elsewhere, provided the axis is clearly labeled. Even then, check the scale before you gasp at a cliff.
Other tricks to watch for: a time series that starts conveniently right after a bad year, two lines on two different vertical scales arranged to look in step, and 3D effects that make front slices look bigger.
Which chart do you need?
Before sharing any chart, run a short checklist. Does it have a title that says what and when? Are both axes labeled with units? Is the source named? Could a stranger read it without you standing beside them explaining? If you must wave your hands, fix the chart.
Pictures give you the shape. Next you will want single numbers that summarize it, starting with the mean, median and mode.
Words to know
Frequency the number of cases that fall into a particular category or interval.
Relative frequency a frequency divided by the total number of cases.
Bar chart a graph with separate bars whose lengths compare categories.
Bin one of the intervals used to group the values of a quantitative variable.
Histogram a graph of counts or shares across bins, showing the shape of a distribution.
Scatter plot a graph with one dot per case, placed by its values on two variables.
Distribution the pattern of which values a variable takes and how often.
Check yourself
- Which chart would you use to compare the number of stores in four neighborhoods?
- A frequency table shows 12 of 48 shoppers paying with cash. What is the relative frequency of cash?
- Using Theo's histogram, what share of days had sales below 50 burritos?
- Why does a histogram have touching bars while a bar chart has gaps?
- A bar chart's axis starts at 50, and two bars show values of 60 and 70. How much taller does the second look, and how much larger is it really?
- Explain why a rising scatter plot does not by itself prove that one variable causes the other.
Show the answers
- A bar chart, because neighborhood is categorical and you are comparing a count across groups.
- The relative frequency is 12 ÷ 48 = 0.25, or 25%.
- The 30–39 and 40–49 bins hold 1 + 3 = 4 days, and 4 ÷ 20 = 20%.
- Histogram bins are neighboring stretches of one number line, while bar chart categories are separate groups.
- Visible heights are 10 and 20, so it looks twice as tall, but 70 ÷ 60 ≈ 1.17, so it is only about 17% larger.
- The pattern could come from a third factor, from reverse causation, or from chance, and the picture cannot tell these apart.