Thirty raw exam scores in a column tell you almost nothing at a glance. Sorting them helps a little, but the real gain comes from grouping: counting how many scores fall into each range and looking at the resulting pattern. A frequency distribution is that grouped count, and a histogram is its picture. Together they are usually the first step in understanding any numerical dataset, because they reveal shape, centre, spread, gaps, and unusual values in one look.
- How to build a frequency table with relative and cumulative frequencies
- How the choice of class width changes what a histogram reveals
- How histograms differ from bar charts, and when to use frequency density
- How to estimate a median from a cumulative frequency curve
Building a Frequency Table
Problem: Thirty students sit a test. Their sorted scores are 52, 58, 61, 63, 64, 66, 67, 68, 69, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 87, 89, 92, 96. Summarize them.
The scores range from 52 to 96, a spread of 44 points. Grouping into classes of width 10, each class includes its lower boundary but not its upper one (so a score of exactly 70 belongs in 70 to under 80, never in two classes at once). Counting the scores in each class gives:
| Class | Frequency | Relative frequency | Cumulative frequency | Cumulative relative |
|---|---|---|---|---|
| 50 to under 60 | 2 | 0.067 | 2 | 0.067 |
| 60 to under 70 | 7 | 0.233 | 9 | 0.300 |
| 70 to under 80 | 12 | 0.400 | 21 | 0.700 |
| 80 to under 90 | 7 | 0.233 | 28 | 0.933 |
| 90 to under 100 | 2 | 0.067 | 30 | 1.000 |
The frequency is the raw count. The relative frequency divides each count by the total (12 ÷ 30 = 0.400), which lets datasets of different sizes be compared and turns counts into proportions. The cumulative frequency is a running total, telling you how many observations fall below the top of each class. From the table alone, 70% of students scored below 80, and only 2 of 30 scored 90 or higher.
From Table to Histogram
A histogram draws each class as a bar whose height reflects its frequency. The bars touch, because the horizontal axis is a continuous number line with no gaps between classes. That is the main visual difference from a bar chart, which shows separate categories with gaps between bars and can be reordered freely. Reordering the bars of a histogram would destroy its meaning.
Here the histogram rises to a peak in the 70s and falls away symmetrically on both sides. The bulk of scores cluster near the middle, with very few at either extreme. Compare that with the summary values: the mean of the raw scores is about 74.5, and so is the median, which agrees with the symmetric look. A right-skewed histogram would show a longer tail toward high values with the mean pulled above the median, a pattern explored in skewness and kurtosis.
Choosing the Class Width
The same data can look very different depending on the width chosen, and no width is universally correct. Splitting the 30 scores into classes of width 5 gives ten bars with counts 1, 1, 3, 4, 6, 6, 4, 3, 1, 1: a similar shape, but with visible small wobbles. Merging into classes of width 20 gives just three bars with counts 9, 19, and 2, which hides the shape almost entirely. Too many narrow classes produce a jagged histogram that reflects random noise; too few wide classes smooth away genuine features such as a second peak.
Several rules of thumb give a starting point:
- Sturges' rule suggests about 1 + log₂(n) classes. For n = 30, that is 1 + 4.91 ≈ 5.9, so about 6 classes (a width near 44 ÷ 6 ≈ 7.3).
- Freedman–Diaconis sets the width to 2 × IQR × n−1/3. With an IQR of 13 (using the median-of-halves quartiles from percentiles and quartiles, Q1 = 68 and Q3 = 81), the width is 2 × 13 ÷ 301/3 ≈ 8.4, or about 5 or 6 classes.
- Scott's rule uses 3.49 × s × n−1/3. With s ≈ 10.1, this gives a width near 11.3, or about 4 classes.
All three land in the range of 4 to 6 classes for this dataset, so width 10 and five classes is a sensible, easy-to-read choice. The rules are guides. Try two or three widths and prefer the one that shows the structure without excessive noise.
Unequal Class Widths and Frequency Density
Sometimes the classes are not all the same width, for example when sparse tails are merged. If the last two classes here were combined into one class "80 to under 100" holding 9 students, drawing its bar with height 9 would exaggerate it, since that bar spans twice the width. The fix is to plot frequency density = frequency ÷ class width, so that bar area represents frequency. For the width-10 classes the densities are 0.2, 0.7, 1.2, 0.7, and 0.2 students per point, while the merged class has 9 ÷ 20 = 0.45. Using density makes the merged bar correctly shorter than the 70-to-80 bar rather than nearly as tall as it.
This is also the bridge to continuous distributions: shrink the classes toward zero width, scale the bar heights so the total area is 1, and the histogram's outline approaches a probability density curve like those in PDF vs. CDF.
The Cumulative Frequency Curve (Ogive)
Plotting cumulative frequency against each class's upper boundary and joining the points gives an ogive. It rises from 0 at the lowest boundary to the total at the highest, and it answers "how many are below this value" questions directly. It also works as a rough empirical CDF.
To estimate the median, find the value where the cumulative frequency reaches half of 30, which is 15. The curve passes 9 at a score of 70 and 21 at 80, so the median lies in the 70s. Interpolating: 70 + (15 − 9) ÷ (21 − 9) × 10 = 70 + 5 = 75. The true median of the raw scores is 74.5, so the grouped estimate is off by only half a point, a small price for working from a table alone. The same grouped-data logic estimates the mean: multiplying each class midpoint by its frequency gives (55 × 2 + 65 × 7 + 75 × 12 + 85 × 7 + 95 × 2) ÷ 30 = 75.0, against a true mean of 74.5, as described in mean, median and mode.
What a Histogram Can Show You
- Shape: symmetric, skewed left or right, or bell-like, which guides the choice between mean and median and hints at whether a normal distribution is a reasonable model.
- Modes: two separate peaks often signal two mixed subgroups worth separating.
- Gaps and outliers: isolated bars far from the rest deserve investigation, complementing the fence method in outlier detection.
- Spread: how widely the bars extend gives an immediate sense of variability.
Real-World Uses
Education: teachers plot score histograms to see whether a test was too easy, too hard, or split the class into two groups, information a class average alone cannot give.
Quality control: manufacturers histogram part dimensions to check that the process is centred on target and within tolerance limits, a starting point before charts like the ones in control charts.
Data exploration: a histogram of every numeric variable is a standard first step in exploratory data analysis, catching data-entry errors and strange distributions before any modelling begins.
Common Mistakes
Leaving gaps between bars. Gaps suggest separate categories. On a continuous scale, bars should touch; an actual empty class shows as a bar of height zero.
Using height instead of density with unequal widths. Plotting raw frequency for classes of different widths misleads the eye, since larger classes look bigger simply because they are wider.
Ambiguous class boundaries. Classes such as "60 to 70" and "70 to 80" leave doubt about where 70 belongs. State the convention clearly, such as "70 to under 80," so every value has exactly one home.
Trusting one bin width. A dramatic feature that vanishes when the bins shift slightly is probably an artefact. Check at least two widths before reading meaning into a bump.
What is the difference between a histogram and a bar chart?
How many classes should a histogram have?
What is relative frequency used for?
Can I calculate exact statistics from a frequency table?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals →