Maths
What is a histogram, and how is it different from a bar chart?
Quick answer
A histogram shows grouped numerical data as touching bars on a number scale, one bar per class. When the classes have different widths, the area of each bar shows the frequency.
In one sentence
A histogram is a chart for numbers that have been sorted into groups (called classes), drawn as bars that touch along a number line.
Explained
Imagine measuring the heights of 30 students. Almost every height is different (148.2 cm, 151.7 cm, 153.0 cm…), so a bar for each exact height would be useless. Instead you group the heights into classes, such as 140–150 cm, 150–160 cm and 160–170 cm, count how many students fall in each class (the frequency) and draw one bar per class. That chart is a histogram.
ruler
clock
notebook
A histogram looks a bit like a bar chart, but there are important differences:
- The horizontal axis is a number scale, not a list of categories. You cannot reorder the bars.
- The bars touch. The classes run straight on from one another: 150 cm is the end of one class and the start of the next. To make clear where a value like 150 belongs, classes are written with inequalities, such as 140 ≤ h < 150 and 150 ≤ h < 160.
- It is for numerical data, usually continuous data that is measured (heights, times, masses), not categories such as favourite fruit.
When all the classes are the same width, the height of each bar is simply the frequency. You can collect the data with a tally chart and draw the bars straight from the totals.
When the classes have different widths, height alone would mislead. Suppose 20 people took 0–10 minutes to finish a puzzle and 20 people took 10–30 minutes. The frequencies are equal, but the second class is twice as wide, so a bar of the same height would look twice as big. The fix is frequency density:
frequency density = frequency ÷ class width
The bar's height is the frequency density, so its area (height × width) is the frequency. Here the densities are 20 ÷ 10 = 2 and 20 ÷ 20 = 1, and both bars have an area of 20.
A histogram shows the shape of the data at a glance: where most values are, how spread out they are, whether the shape is symmetrical or has a long tail to one side (skewed), and whether there are gaps or unusual values. Shape is the first thing statisticians look at before they work out an average such as the mean, median or mode.
Examples
Time 62 students spent on homework one evening:
| Time t (minutes) | Frequency | Class width | Frequency density |
|---|---|---|---|
| 0 ≤ t < 10 | 8 | 10 | 8 ÷ 10 = 0.8 |
| 10 ≤ t < 20 | 14 | 10 | 14 ÷ 10 = 1.4 |
| 20 ≤ t < 40 | 24 | 20 | 24 ÷ 20 = 1.2 |
| 40 ≤ t < 60 | 10 | 20 | 10 ÷ 20 = 0.5 |
| 60 ≤ t < 90 | 6 | 30 | 6 ÷ 30 = 0.2 |
Notice that the 20–40 class has the most students (24), but the tallest bar is 10–20 (density 1.4), because the 20–40 class is twice as wide.
Worked example: estimate how many students worked between 30 and 50 minutes. Take half of the 20–40 bar (1.2 × 10 = 12) and half of the 40–60 bar (0.5 × 10 = 5). That gives about 17 students. It is an estimate, because we assume the values are spread evenly inside each class.
Common mistakes
- Leaving gaps between the bars. That makes a bar chart. Fix: the bars of a histogram sit edge to edge.
- Plotting frequency when the widths are unequal. Fix: work out frequency density first and label the vertical axis "frequency density".
- Getting the class width wrong. 20 ≤ t < 40 is 20 wide, not 40 or 19. Fix: width = upper bound − lower bound.
- Reading the frequency from the height. Fix: with unequal widths, frequency = frequency density × class width, the area of the bar.
Step by step
Step by step
- Group the dataChoose classes that do not overlap and write them with inequalities, such as 10 ≤ t < 20.
- Find each class widthUpper bound minus lower bound.
- Work out frequency densityFrequency ÷ class width. (If all the widths are equal, you may plot the frequency instead.)
- Draw the axesA continuous number scale across the bottom; frequency density up the side.
- Draw touching barsEach bar runs from its lower bound to its upper bound, with height equal to its frequency density. Check that each area equals the frequency.
Reading a histogram is the same steps backwards: read the class width from the horizontal axis, read the density from the vertical axis, and multiply to get the frequency.
Practice questions
Histograms
Try each one, then check your answer.
- What is the width of the class 0 ≤ x < 5?
Show answer
5 − 0 = 5 - What is the width of the class 20 ≤ h < 50?
Show answer
50 − 20 = 30 - A class has frequency 12 and width 4. What is its frequency density?
Show answer
12 ÷ 4 = 3 - A class has frequency 45 and width 15. What is its frequency density?
Show answer
45 ÷ 15 = 3 - A class has frequency 9 and width 10. What is its frequency density?
Show answer
9 ÷ 10 = 0.9 - A bar has frequency density 1.6 and width 5. What is its frequency?
Show answer
1.6 × 5 = 8 - A bar has frequency density 0.4 and width 25. What is its frequency?
Show answer
0.4 × 25 = 10 - A bar runs from 30 to 50 on the horizontal axis and has height 2.5. What is its frequency?
Show answer
Width 20, so 2.5 × 20 = 50 - Which needs a histogram: (a) favourite fruit of a class, (b) times to run 100 m?
Show answer
(b): times are continuous numerical data. - Equal-width classes 0–10, 10–20 and 20–30 have frequencies 4, 9 and 7. Which is the modal class?
Show answer
The tallest bar: 10–20 - A histogram has densities 1.5 for 0–10, 2 for 10–20 and 0.8 for 20–40. What is the total frequency?
Show answer
15 + 20 + 16 = 51 - In the histogram from question 11, estimate how many values lie between 30 and 40.
Show answer
Half of the 20–40 bar: 0.8 × 10 = 8 - In the histogram from question 11, estimate how many values are less than 15.
Show answer
15 + 2 × 5 = 25 - Class 10 ≤ t < 20 has frequency 14, and class 20 ≤ t < 40 has frequency 24. Which bar is taller?
Show answer
Densities are 1.4 and 1.2, so the 10–20 bar is taller. - Why does a histogram with unequal class widths use frequency density?
Show answer
So that the area of each bar shows the frequency. Otherwise wide classes look too big.
Word problems
Histograms in real life
Try each one, then check your answer.
- In a survey, 18 students took between 20 and 30 minutes to get to school. What frequency density is plotted for that class?
Show answer
18 ÷ 10 = 1.8 - On a histogram of parcel masses, the bar from 2 kg to 2.5 kg has frequency density 40 (parcels per kg). How many parcels is that?
Show answer
40 × 0.5 = 20 parcels - Seedling heights: 0 ≤ h < 5 cm: 10 plants, 5 ≤ h < 10 cm: 16 plants, 10 ≤ h < 20 cm: 12 plants. Find the three frequency densities.
Show answer
10 ÷ 5, 16 ÷ 5 and 12 ÷ 10: 2, 3.2 and 1.2 - A histogram of bus trip times has bars 0–10 min (density 3), 10–15 min (density 4) and 15–30 min (density 2). How many trips took 10 minutes or more?
Show answer
4 × 5 + 2 × 15 = 20 + 30 = 50 trips - Using the same histogram, estimate how many trips took less than 20 minutes.
Show answer
3 × 10 + 4 × 5 + 2 × 5 = 30 + 20 + 10 = 60 trips
Questions people ask
What is a histogram used for?
A histogram shows how numerical data is distributed: where most values are, how spread out they are and what shape the data has. It is used for things like heights, test scores, reaction times and waiting times.
What is the difference between a histogram and a bar chart?
A bar chart compares separate categories and has gaps between the bars, which can be in any order. A histogram shows numerical data grouped into classes on a number scale, so the bars touch and stay in order. With unequal classes, a histogram's frequency is shown by area, not height.
What type of data is a histogram used for?
Continuous numerical data, such as lengths, masses and times. It can also show discrete data with many possible values (like test scores out of 100) once they are grouped.
What is frequency density?
Frequency density is frequency ÷ class width. It is the height of a histogram bar when the classes have different widths, and it makes the area of each bar equal to the frequency.
How do you make a histogram in Excel, Google Sheets or Python?
In Excel 2016 or later, select the data and choose Insert, then the statistic chart button, then Histogram. In Google Sheets, choose Insert, Chart and set the chart type to Histogram. In Python, matplotlib's plt.hist(data, bins=…) draws one. These tools plot counts with equal-width bins, so a histogram with unequal classes still needs frequency density worked out by hand.
What does the shape of a histogram tell you?
A symmetrical, hill-shaped histogram means most values are near the middle. A long tail to the right (positive skew) means a few values are much larger than the rest, as with incomes. Two peaks can mean two different groups have been mixed together.
Quick quiz
Histograms
Check what you know with 5 quick questions.
Question 1 of 5
Which data is best shown in a histogram?
Practise it
Try it
Practise histograms with unlimited questions
Statistics worksheets
Practise it step by step in a full course: Grade 9 Maths
For grown-ups
Related topics
Bar charts
A bar chart shows data using bars of different lengths. The longer the bar, the bigger the number. In the US it is usually called a bar graph.
Mean, median and mode
Mean, median and mode are three kinds of average. The mean shares the total out equally, the median is the middle value in order, and the mode is the most common value.
Tally charts
A tally chart is a table that counts things with little marks. Each mark is one, and every fifth mark crosses the four before it, so you can count in fives.
Cumulative frequency
Cumulative frequency is a running total of frequencies. Add each frequency to the total so far; the last value equals the total, and a cumulative frequency graph gives the median and quartiles.
Frequency polygons
A frequency polygon is a line graph of a grouped frequency table. Plot each class's frequency above the class midpoint and join the points with straight lines.
Relative frequency
Relative frequency is how often something happens compared with the total, frequency ÷ total. If 6 of 20 students walk to school, the relative frequency is 6/20 = 0.3, or 30%.