Bin (Histogram Bin) in a Graph
TERMA value range in a histogram that data points are grouped into.
A bin is one of the equal-width value ranges a histogram uses to group numeric data — for example scores 70–79 or heights 160–165 cm. Each data point is counted into the bin its value falls in, and the height of that bin's bar shows how many values landed there, revealing the shape of the distribution.
Bins are what turn a long list of raw numbers into a picture. A list of 500 delivery times tells you little at a glance; sorted into ten-minute bins, it instantly shows whether most deliveries cluster around 30 minutes, whether there is a long tail of late ones, and whether there are two separate peaks. Bins are also called classes, class intervals or buckets.
How bins work: a worked example
Take these 20 exam scores:
52, 58, 61, 64, 67, 68, 71, 72, 73, 75, 76, 77, 78, 81, 82, 84, 86, 88, 91, 95
Choose bins 10 points wide, starting at 50. Each bin includes its lower edge and excludes its upper edge, so a score of exactly 60 would go in 60–69, not 50–59. Counting the scores into each bin gives:
| Bin | Scores in the bin | Count (frequency) |
|---|---|---|
| 50–59 | 52, 58 | 2 |
| 60–69 | 61, 64, 67, 68 | 4 |
| 70–79 | 71, 72, 73, 75, 76, 77, 78 | 7 |
| 80–89 | 81, 82, 84, 86, 88 | 5 |
| 90–99 | 91, 95 | 2 |
The counts add up to 20, one for every score. Drawn as a histogram, the tallest bar sits over 70–79 and the bars fall away on both sides — a roughly symmetric, single-peaked distribution.
What type of data can be binned? (Interval, ratio, ordinal)
Histograms and bins are for quantitative data — numbers measured on an interval or ratio scale, where the distance between values is meaningful. Exam scores, temperatures, ages, prices and durations all qualify, especially continuous data. Large-range discrete counts (such as daily website visits) can also be binned.
| Measurement level | Example | Use bins / histogram? |
|---|---|---|
| Ratio | Weight, income, time taken | Yes |
| Interval | Temperature in °C, calendar year | Yes |
| Ordinal | Satisfaction rating 1–5, small / medium / large | No — use a bar chart of each level |
| Nominal | Country, colour, blood type | No — use a bar chart or pie chart |
Ordinal and nominal data are already grouped into a few named levels, so there is nothing to bin: each level gets its own bar, with gaps between bars, in an ordinary bar chart. See data types explained for the full nominal–ordinal–interval–ratio breakdown and categorical data for the non-numeric side.
How many bins should you use?
There is no single correct number, but these common rules of thumb give a sensible starting point for n data points:
- Square-root rule: number of bins ≈ √n, rounded up. For 100 values, √100 = 10 bins.
- Sturges' rule: number of bins = ⌈log₂ n⌉ + 1. For 100 values, log₂ 100 ≈ 6.6, rounded up to 7, plus 1 = 8 bins. It works best for moderately sized, roughly bell-shaped data and tends to use too few bins for large datasets.
- Freedman–Diaconis rule: bin width = 2 × IQR × n−1/3, where IQR is the interquartile range (the distance between the first and third quartiles). Because it uses the IQR, it is less affected by outliers.
For the 20 exam scores above, the square-root rule suggests about 5 bins and Sturges' rule about 6 — consistent with the 5 bins of width 10 used. In practice, start with a rule, then pick a nearby width that gives round, readable edges (5, 10, 25, 100) and try a couple of alternatives.
Why bin width changes the picture
Bins that are too wide merge everything into a few bars and hide real features such as two separate peaks. Bins that are too narrow leave many bars with zero or one value, so the chart looks jagged and random noise looks like structure. Shifting the starting point of the bins, even without changing their width, can also change the shape. If a pattern appears with one bin width and vanishes with another, treat it with caution.
Using bins of unequal width without adjusting the bar heights to show density (wide bins then look artificially large); leaving it unclear which bin a boundary value belongs to; drawing gaps between histogram bars, which makes it look like a bar chart of categories; and trying to bin ordinal or nominal data.
How to read binned data
- Read the x-axis to learn the bin width and where the bins start.
- Find the tallest bar: that bin contains the most common range of values.
- Look at the overall shape: symmetric, skewed to one side, or with more than one peak.
- Look for isolated bars far from the rest, which may be outliers.
- Remember that you can no longer see individual values inside a bin — only how many fell into it.
For more on building and interpreting histograms, see the histogram guide.
Frequently asked questions
In graphs, what is a bin?
A bin is a range of values, such as 70 to 79, that a histogram uses to group data. Each value is counted into the bin it falls in, and the height of the bar above the bin shows how many values it contains.
What data type does a histogram use: interval, ratio or ordinal?
A histogram uses quantitative data measured on an interval or ratio scale, such as temperature, time, weight or test scores. Ordinal and nominal data are already in named groups and should be shown with a bar chart instead.
How many bins should a histogram have?
A common starting point is the square-root rule, about the square root of the number of values, or Sturges' rule, log2 of n rounded up plus 1. For 100 values these give 10 and 8 bins. Then adjust to a round, readable bin width.
Which bin does a value on the boundary go in?
By the usual convention, each bin includes its lower edge and excludes its upper edge, so a value of exactly 60 goes in the 60 to 69 bin. Whatever rule a chart uses, it should be applied consistently.
Do histogram bins have to be the same width?
Equal widths are standard and easiest to read. Unequal widths are possible, but then the bar heights must show density, the count divided by the bin width, or wide bins will look misleadingly large.