How Histograms Work
The histogram is one of my favorite basic chart types, because it lets you quickly see the shape and distribution of a dataset. However, a lot of people don’t know what a histogram shows or how the chart works.
This is a guide for that. Because seeing distributions is way more interesting than means and medians, which oftentimes overgeneralize.
Start with some random data. We don’t care what the data is about right now. All you need to know is that darker dots represent higher values, and lighter dots represent lower values. The positions of the dots are random and don’t mean anything.
Given the random positions, it’s tough to make out any patterns in the data. Are there more data points on the low end or on the high end? What about values in the middle?
A straightforward thing to do: Line up all the dots in increasing order from left to right. You get something that looks like a gradient and takes up a lot of horizontal space.
It’s still not obvious how frequently different values appear. You could count, but that defeats the purpose of visualizing the data. Just make a table if you’re going to count.
How about if you put dots with the same (rounded) values in a stack and still sort horizontally? You get several stacks (or columns) of dots placed horizontally based on their values. Now you can easily see higher and lower stacks and where they sit on the value axis (the x-axis). Most of the data falls into the middle with fewer as you move out to the edges.
You can make out the shape of the data and see individual data points. But what if you have a million data points instead of a hundred. There are only so many pixels on the screen or so much space on paper to show the individual dots. So instead, you can abstract the dot columns into bars. Bar heights match the heights of the dot columns.
The bars make the shape of the data straightforward. Again, you see higher frequencies in the middle of the value spectrum and then the bar heights taper off as you move away from the middle.
When you see just means and medians, you only see a sliver of the middle and miss out on all the details of the full dataset. Maybe the spread is wider. Maybe it’s really narrow. Maybe the shape favors the left side or the right side.
In this example, the shape is mostly centered, and if you’ve taken a statistics course, you might recognize it as a normal distribution. All the recurring shapes tend to have a name like Poisson distribution, uniform, binomial, etc. If you know all the distributions, then that’s great, but you don’t have to know the names to get use out of them. Here are a handful of common distributions:
In any case, the challenge I think in understanding histograms and communicating with them is the jump from stacked dots to the abstracted rectangles. Keep this step in mind when analyzing or presenting and the distributions will hopefully get the attention they deserve. Not everyone understands histograms, but we’ll get there eventually.
Here’s some software-specific advice on histograms.
If the histogram isn’t doing it for you, there are other ways to see distributions.
Become a member. Learn to visualize data. From beginner to advanced.Join Today
This is for people interested in the process of creating, designing, and exploring data graphics. Your support goes directly to FlowingData, an independently run site.
What You Get
- Instant access to tutorials on how to make and design data graphics
- Source code and files to use with your own data
- In-depth courses on visualization in R
- Hand-picked links and resources from around the web
- Members-only newsletter
Peak Non-Creepy Dating Pool
Based on the “half-your-age-plus-seven” rule, the range of people you can date expands with age. Combine that with population counts and demographics, and you can find when your non-creepy dating pool peaks.
How You Will Die
So far we’ve seen when you will die and how other people tend to die. Now let’s put the two together to see how and when you will die, given your sex, race, and age.
A Day in the Life of Americans
I wanted to see how daily patterns emerge at the individual level and how a person’s entire day plays out. So I simulated 1,000 of them.