- Histograms vs bar charts
- Frequency tables and grouped data · coming soon
- Cumulative frequency
- Reading histograms
- Median and quartiles from a histogram · coming soon
- The normal distribution · coming soon
A table that hides its own widths
The last lecture showed why a histogram uses frequency density. Now you have to draw one from a real table, like this one: a club secretary's record of the ages of 75 running-club members.
| Age (years) | Frequency |
|---|---|
| 16–19 | 8 |
| 20–24 | 15 |
| 25–34 | 22 |
| 35–44 | 18 |
| 45–64 | 12 |
Before you can divide anything, you need each class width. So answer one question first. How wide is the class 16–19?
Most people say 3, because 19 − 16 = 3. But a member who is 19 years and 11 months old says she is 19, so she belongs in this class. The class does not stop at 19. It stops at the 20th birthday. So 16–19 runs from 16 up to 20, and its width is 4 years.
That is where the difficulty in drawing histograms lives. The arithmetic is one division per class. The hard part is the decisions around it: where each class really begins and ends, what scale fits the paper, and where each axis starts. This lecture takes them one at a time, in four steps.
Step 1: find the true class boundaries
A class boundary is the exact value where one class ends and the next begins. The bars start and stop at the boundaries, so they come first. Tables write classes in three common ways.
Classes written with inequalities. A class such as gives its boundaries directly: 20 and 25.
Measurements rounded to the nearest unit. Suppose masses are recorded to the nearest kilogram, and a class is written 55–59. A mass recorded as 55 kg could really be anything from 54.5 kg up to 55.5 kg. A mass recorded as 59 kg could be just below 59.5 kg. So the class really runs from 54.5 to 59.5, and its width is 5 kg, not 4. This is the same half-way rule that the cumulative frequency lecture used for its upper boundaries.
Ages in completed years. Age is never rounded up: at 16 years and 11 months, a person still says "16". So the age class 16–19 has boundaries 16 and 20.
In both pictures, the class is wider than the gap between its written limits, and exactly as wide as the step from its own start to the start of the next class. This gives a quick test for both kinds of table: the width of a class is the start of the next class minus its own start. For 55–59, the next class starts at 60, and 60 − 55 = 5. For 16–19, the next class starts at 20, and 20 − 16 = 4. For the last class there is no next class, so continue the pattern: 45–64 is followed by 65, so its width is 20.
Plant heights are measured to the nearest centimetre and grouped as 10–14, 15–19 and 20–29. What are the three class widths?
Show the answer
5, 5 and 10 cm. The boundaries are 9.5, 14.5, 19.5 and 29.5. The quick test agrees: 15 − 10 = 5, 20 − 15 = 5 and 30 − 20 = 10. The tempting answers, 4, 4 and 9, come from subtracting the written limits. Each is 1 too small, and 4 instead of 5 makes a density 25% too large.
Step 2: widths and densities in one table
Now extend the table: boundaries, then width, then frequency density. A table makes every step visible, so a mistake in one row cannot hide.
| Age (years) | Boundaries | Class width | Frequency | Frequency density (people per year) |
|---|---|---|---|---|
| 16–19 | 16 to 20 | 4 | 8 | 8 ÷ 4 = 2 |
| 20–24 | 20 to 25 | 5 | 15 | 15 ÷ 5 = 3 |
| 25–34 | 25 to 35 | 10 | 22 | 22 ÷ 10 = 2.2 |
| 35–44 | 35 to 45 | 10 | 18 | 18 ÷ 10 = 1.8 |
| 45–64 | 45 to 65 | 20 | 12 | 12 ÷ 20 = 0.6 |
Each density is in people per year of age, because frequency counts people and width counts years. The units remind you what a height means: how crowded that age range is.
Some densities will not be neat. Thirteen people in a class 30 years wide give 13 ÷ 30 = 0.4333… people per year. Write ≈ 0.43 in the table: two decimal places is closer than you can draw by hand.
Notice the last row. Twelve people are spread over twenty years, so the density, 0.6, is the lowest in the table. If the bar were drawn 12 units high, it would be taller than the 8-person bar at the start, and five times as wide. Its area would be 12 × 20 = 240, against 8 × 4 = 32. The picture would claim 7.5 times as many people, when the truth is 1.5 times as many. The density column is what prevents that.
Step 3: choose the scales
This is the step a table cannot do for you. The histogram must fit on your graph paper, clearly. Two scales are needed.
The horizontal axis is a true number line for the variable. Equal distances must stand for equal amounts: every 5 years takes the same space, everywhere along the axis. It does not have to start at 0. The club's ages run from 16 to 65, so an axis from 15 to 65 uses the paper well; some books draw a small zigzag near the origin to show this. On paper 20 cm wide, 2 cm for every 5 years makes those 50 years exactly 20 cm.
The vertical axis shows frequency density, and it must start at 0. The reason is area. A bar's area is its frequency only if the whole bar is drawn, from 0 up. Cut off the bottom of the axis and every bar loses the same strip: a little of a tall bar, almost all of a short one.
For the vertical scale, use two tests. First, the tallest bar should use more than half the height of the paper. Second, the scale should be easy to plot. On paper with 2 mm squares, choose a scale where one small square is an easy amount, such as 0.05, 0.1, 0.2 or 0.5 of a unit. Then a value like 2.2 lands on a line. With 3 cm per unit, one small square is one fifteenth of a unit, and 2.2 falls between the lines. Try both tests below.
The paper is 15 cm tall. The horizontal scale is fixed at 2 cm for every 5 years. Choose how many centimetres stand for one unit of frequency density. Then move the start of the vertical axis away from 0 and watch the areas.
Vertical scale:
Vertical axis starts at: 0
The table shows four vertical scales for the running-club histogram on paper 15 cm tall. The tallest bar has frequency density 3.
| Vertical scale | Tallest bar (3 people per year) | Fits on 15 cm? | Height used |
|---|---|---|---|
| 2 cm per unit | 6 cm | yes | 40% |
| 4 cm per unit | 12 cm | yes | 80% |
| 5 cm per unit | 15 cm | only just | 100% |
| 6 cm per unit | 18 cm | no | — |
Changing the scale changes only the size of the picture. With the axis starting at 0, the 20 to 25 bar always has 1.25 times the area of the 45 to 65 bar, because 15 ÷ 12 = 1.25. If the axis starts at 0.5 instead, the bars are 2.5 and 0.1 units tall above the axis, so their areas are in the ratio (2.5 × 5) : (0.1 × 20) = 12.5 : 2, which is 6.25. The picture would then claim more than six times as many people in the first class.
Every scale with the axis at 0 gave the same ratio, 1.25, between the two bars. A bigger scale makes a bigger picture, not a different one; the 6 cm scale failed only because it did not fit. Moving the start of the axis changed the story itself. At 0.5, the 20–25 bar looked more than six times as big as the 45–65 bar. From 0.6, the oldest members disappeared. For this paper, 4 cm per unit is the best choice: the tallest bar is 12 cm, which is 80% of the height, and one small square is 0.05, so every density lands exactly on a line.
Step 4: draw, label and check
Draw each bar with its edges exactly on the class boundaries and its top at the frequency density. Neighbouring bars share an edge, so they touch. A gap appears only where a class really is empty.
Then label both axes: "Age (years)" along the bottom and "Frequency density" up the side, with its units where there is room. This label matters: "Frequency" there would tell the reader to read heights as counts, the very mistake frequency density prevents.
Finally, check. Multiply each height by its width, and add:
= 8 + 15 + 22 + 18 + 12 = 75
The areas add up to 75, the number of members ✓. That is it. That is the whole method.
1. Find the true class boundaries. Width = upper boundary − lower boundary, which is also the start of the next class minus the start of this one.
2. For every class, .
3. Choose scales: a true number line for the variable; frequency density from 0, with the tallest bar using most of the paper.
4. Draw touching bars between the boundaries, label both axes, and check that the areas add up to the total frequency.
The area check has one blind spot, and it is worth knowing before you trust it. Test it below.
Forty plant heights were measured to the nearest centimetre: 10–14 cm: 6 plants; 15–19 cm: 14; 20–29 cm: 16; 30–49 cm: 4. A student works out the frequency densities. Exactly one line is wrong. Tap it.
A student's working for forty plant heights measured to the nearest centimetre (10–14 cm: 6; 15–19: 14; 20–29: 16; 30–49: 4), with the mistake marked.
- Heights were measured to the nearest cm, so the class 10–14 runs from 9.5 up to 14.5 cm.
- Width of 10–14: 14.5 − 9.5 = 5 cm. Density: 6 ÷ 5 = 1.2 plants per cm.
- Width of 15–19: 19.5 − 14.5 = 5 cm. Density: 14 ÷ 5 = 2.8 plants per cm.
- Wrong: Width of 20–29: 29 − 20 = 9 cm. Density: 16 ÷ 9 ≈ 1.78. The boundaries are 19.5 and 29.5, so the width is 10 cm and the density is 1.6.
- Width of 30–49: 49.5 − 29.5 = 20 cm. Density: 4 ÷ 20 = 0.2 plants per cm.
- Check: 1.2 × 5 + 2.8 × 5 + 1.78 × 9 + 0.2 × 20 ≈ 40. The check passes because it uses the same wrong width twice, so it cannot catch a wrong width.
The check passed with a wrong width, because the wrong width was used twice: 16 ÷ 9 × 9 is still 16. The area check catches slips in division and drawing, not a wrong boundary. That is why Step 1 deserves the most care.
Worked examples
The lengths of 50 leaves collected in a biology survey are grouped as follows: cm: 5 leaves; : 11; : 17; : 12; : 5. Draw the histogram.
Step 1. The inequalities give the boundaries. Every class is 2 cm wide.
Step 2. Divide each frequency by 2: 2.5, 5.5, 8.5, 6 and 2.5 leaves per cm.
Step 3. Horizontal axis from 4 to 14 cm. On paper 15 cm tall, 1 cm per unit makes the tallest bar 8.5 cm, more than half the height.
Step 4. Five touching bars of equal width. The tallest is in the middle, and the heights fall away evenly on both sides, so the shape is roughly symmetric.
With equal widths, many courses also accept frequency on the vertical axis: every bar is then twice as tall, and the shape is the same. Frequency density works for every table, so keep it as your habit unless your course says otherwise.
Check. 2.5 × 2 + 5.5 × 2 + 8.5 × 2 + 6 × 2 + 2.5 × 2 = 5 + 11 + 17 + 12 + 5 = 50 ✓.
The masses of 60 adults are recorded to the nearest kilogram (invented data): 45–54 kg: 9; 55–59: 12; 60–64: 15; 65–74: 18; 75–94: 6. Draw the histogram.
Step 1. The masses are rounded to the nearest kilogram, so the boundaries are half-way: 44.5, 54.5, 59.5, 64.5, 74.5 and 94.5. The widths are 10, 5, 5, 10 and 20 kg. The quick test agrees: 55 − 45 = 10, 60 − 55 = 5, and so on.
Step 2. 9 ÷ 10 = 0.9, 12 ÷ 5 = 2.4, 15 ÷ 5 = 3, 18 ÷ 10 = 1.8 and 6 ÷ 20 = 0.3 people per kilogram.
Step 3. Horizontally, 1 cm for every 5 kg from 40 to 100 kg, so one 2 mm square is 1 kg and 54.5 sits half-way across a square. Vertically, 4 cm per unit makes the tallest bar 12 cm.
Step 4. The bars start at 44.5 and end at 94.5, not at the round numbers on the axis.
The narrow classes 55–59 and 60–64 hold fewer people than 65–74, but they are the most crowded part of the data.
Check. 0.9 × 10 + 2.4 × 5 + 3 × 5 + 1.8 × 10 + 0.3 × 20 = 9 + 12 + 15 + 18 + 6 = 60 ✓.
A clinic records how long 60 patients wait (invented data): minutes: 18; : 24; : 15; : 0; 15 minutes or more: 3. The longest wait was 22 minutes. Draw the histogram.
Think first. Two classes need a decision. The empty class 10 to 15 still takes its 5 minutes of space on the axis, with no bar. The last class is open: it has no upper boundary, so you must choose one. The longest wait was 22 minutes, so end it at a round number above that, 25, and say so in a note under the histogram.
Steps 1 and 2. Widths 2, 3, 5, 5 and 10. Densities: 18 ÷ 2 = 9, 24 ÷ 3 = 8, 15 ÷ 5 = 3, 0 ÷ 5 = 0 and 3 ÷ 10 = 0.3 patients per minute.
Steps 3 and 4. The axis runs from 0 to 25 minutes. With 1 cm per unit, the tallest bar is 9 cm.
Someone else might end the open class at 22 instead. Then its height would be 3 ÷ 7 ≈ 0.43, not 0.3. The area, 3 patients, would be the same. The choice changes the shape of the last bar, never its count, which is why it must be stated.
Check. 9 × 2 + 8 × 3 + 3 × 5 + 0 × 5 + 0.3 × 10 = 18 + 24 + 15 + 0 + 3 = 60 ✓.
The class 55–59 kg is 5 kg wide, not 4, and the age class 16–19 is 4 years wide, not 3. Find the boundaries first, or use the quick test: the start of the next class minus the start of this one. The area check will not catch this mistake.
Starting the density axis above 0 cuts the same strip off every bar, so areas no longer match frequencies. The horizontal axis may start anywhere; the vertical axis may not.
Bars drawn from 55 to 59 and then from 60 to 64 leave a false gap between 59 and 60; bars go from boundary to boundary. The opposite mistake is to close up an empty class, which must keep its place on the axis as a gap.
Work each one on paper first. Open a hint only when you are stuck.
-
The heights of 40 seedlings are grouped as cm: 6; : 14; : 12; : 8. (a) Find the frequency densities. (b) Your paper is 10 cm tall. Which vertical scale is best: 2 cm, 2.5 cm or 3 cm per unit?
Hint 1
Every class is 4 cm wide, so divide every frequency by 4.
Hint 2
Multiply the tallest density by each scale. Does it fit in 10 cm? Is the scale easy to plot?
Full answer
(a) 6 ÷ 4 = 1.5, 14 ÷ 4 = 3.5, 12 ÷ 4 = 3 and 8 ÷ 4 = 2 seedlings per cm. (b) The tallest bar is 3.5. At 3 cm per unit it needs 10.5 cm, which does not fit. At 2.5 cm per unit it is 8.75 cm, which fits, but 2.5 cm per unit makes values like 1.5 hard to place on 2 mm squares. At 2 cm per unit it is 7 cm, which is 70% of the height, and each 0.5 is exactly 1 cm. So 2 cm per unit is best. Check: 1.5 × 4 + 3.5 × 4 + 3 × 4 + 2 × 4 = 6 + 14 + 12 + 8 = 40 ✓.
-
The lengths of 60 fish are measured to the nearest centimetre: 10–19 cm: 8; 20–24: 15; 25–29: 18; 30–39: 12; 40–59: 7. Find the class boundaries, the widths and the frequency densities.
Hint 1
Rounded to the nearest centimetre, so the boundaries are half-way: the first class starts at 9.5.
Hint 2
The quick test: 20 − 10 = 10, 25 − 20 = 5, and so on.
Full answer
Boundaries 9.5, 19.5, 24.5, 29.5, 39.5 and 59.5. Widths 10, 5, 5, 10 and 20 cm. Densities 8 ÷ 10 = 0.8, 15 ÷ 5 = 3, 18 ÷ 5 = 3.6, 12 ÷ 10 = 1.2 and 7 ÷ 20 = 0.35 fish per cm. The most crowded lengths are 24.5 to 29.5 cm. Check: 0.8 × 10 + 3 × 5 + 3.6 × 5 + 1.2 × 10 + 0.35 × 20 = 8 + 15 + 18 + 12 + 7 = 60 ✓.
-
A cinema records the ages, in completed years, of 102 visitors: 5–14: 12; 15–24: 30; 25–39: 27; 40–59: 24; 60 and over: 9. The oldest visitor was 81. (a) Choose an end for the last class and find all the frequency densities. (b) Another student ends the last class at 85. What changes, and what does not?
Hint 1
Ages in completed years: 5–14 runs from 5 up to 15.
Hint 2
The last class must include 81. A round number above it, such as 90, is a sensible end.
Full answer
(a) Boundaries 5, 15, 25, 40, 60 and (chosen) 90. Widths 10, 10, 15, 20 and 30 years. Densities 1.2, 3, 1.8, 1.2 and 9 ÷ 30 = 0.3 people per year. (b) With an end at 85, the width is 25 and the density is 9 ÷ 25 = 0.36, so the last bar is narrower and taller. Its area is still 9 people, and every other bar is unchanged. Whichever end is chosen should be stated under the histogram. Check: 12 + 30 + 1.8 × 15 + 1.2 × 20 + 0.3 × 30 = 12 + 30 + 27 + 24 + 9 = 102 ✓.
-
Ravi draws the running-club histogram with 1 cm for every 5 years across, and 1 cm for every 0.5 people per year up the side. (a) How many people does 1 cm² of his paper stand for? (b) How wide and how tall, in centimetres, is his 45–64 bar, and how many people does its area show? (c) Four new members aged 65–74 join. How tall, in centimetres, should their bar be?
Hint 1
One square centimetre is 5 years across and 0.5 people per year high. Multiply the two.
Hint 2
The class 65–74 runs from 65 up to 75, so it is 10 years wide, which is 2 cm on Ravi's paper.
Full answer
(a) 5 years × 0.5 people per year = 2.5 people. (b) The class is 20 years wide, so the bar is 20 ÷ 5 = 4 cm wide. Its density is 0.6, so it is 0.6 ÷ 0.5 = 1.2 cm tall. Its area is 4 × 1.2 = 4.8 cm², and 4.8 × 2.5 = 12 people ✓. (c) Four people need 4 ÷ 2.5 = 1.6 cm² of paper. The bar is 2 cm wide, so it is 1.6 ÷ 2 = 0.8 cm tall. Check by density: 4 ÷ 10 = 0.4 people per year, and 0.4 ÷ 0.5 = 0.8 cm ✓. Some exam questions give a key such as "1 cm² = 2.5 people" instead of a labelled axis; this is how to use one.
Every table in this lecture came with its classes already chosen. With raw data, you choose them yourself, and the choice changes the picture. Too few classes hide the shape. Too many make the bars jumpy.
In 1926, the statistician Herbert Sturges suggested a rule: for n values, use about classes. For the 75 club members that is about 7.2, so 7 or 8 classes. Statistical software still uses his rule as a default, although later statisticians showed that it gives too few classes for large data sets. No rule replaces looking. A good statistician draws the histogram with several different classes and trusts only the features that survive every choice. Frequency density makes that comparison fair, because every version has the same total area.
- A histogram's bars start and end at the true class boundaries, which may differ from the limits written in the table.
- For data rounded to the nearest unit, the boundaries are half-way between classes; for ages in completed years, a class such as 16–19 runs from 16 up to 20.
- A class width is the upper boundary minus the lower boundary, which equals the start of the next class minus the start of this one.
- The vertical axis shows frequency density and must start at 0, because the area of each whole bar is its frequency.
- A good vertical scale lets the tallest bar fill most of the paper and makes every value easy to plot.
- The areas should add up to the total frequency, but this check cannot catch a wrong class width.