Histogram with Frequency: How to Read and Make One
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
A histogram with frequency is a bar chart that shows how often values fall into equal-width intervals (bins), with bar height representing the count (frequency) of data points in each bin. You enter a set of numerical data, and the calculator groups it into bins, counts the frequencies, and displays the distribution so you can see the shape, center, and spread at a glance.
Formula
The histogram formula is simple: divide the range of your data (max − min) by the number of bins to get the bin width, then count how many data points fall into each interval. For a dataset with values x1, x2, …, xn and k bins, the bin width is:
Bin width = (max − min) / k
Each bin covers an interval [min + (i−1)·width, min + i·width) for i = 1 to k. The frequency of a bin is the number of data points that satisfy min + (i−1)·width ≤ x < min + i·width. The last bin includes the maximum value.
In the calculator above, the expression hist(d, b) returns a list of frequencies, and breaks(d, b) returns the bin boundaries. The first output shows the frequency list, which is the core answer the page title asks for.
Worked Example
Using the default data values: 1, 2, 2, 3, 3, 3, 4, 4, 5 and 5 bins:
- Find the range: max = 5, min = 1, so range = 5 − 1 = 4.
- Bin width = 4 / 5 = 0.8.
- Bin boundaries: 1.0, 1.8, 2.6, 3.4, 4.2, 5.0.
- Count frequencies:
- Bin [1.0, 1.8): values 1 → 1
- Bin [1.8, 2.6): values 2, 2 → 2
- Bin [2.6, 3.4): values 3, 3, 3 → 3
- Bin [3.4, 4.2): values 4, 4 → 2
- Bin [4.2, 5.0]: value 5 → 1
The result is frequencies [1, 2, 3, 2, 1], which matches the calculator output. Notice the distribution is symmetric and bell-shaped, peaking at the middle bin.
When to Use a Frequency Histogram
Use a histogram when you have continuous numerical data and want to see the overall distribution. It answers questions like: What is the typical value? Are the data skewed left or right? Are there gaps or outliers? Histograms are common in quality control (e.g., part dimensions), finance (e.g., returns), and any field that collects measurements.
Unlike a bar chart, which shows categorical data, a histogram shows numerical data with no gaps between bars (unless a bin has zero count). The x-axis is a continuous scale, and the y-axis is the frequency (count) or sometimes relative frequency (proportion).
How to Choose the Number of Bins
Choosing the right number of bins is the most important step. Too few bins hide detail; too many create noise. Common rules of thumb:
- Sturges’ rule: bins = ⌈log₂(n) + 1⌉, where n is the number of data points. For n = 100, that gives about 8 bins.
- Square-root rule: bins = ⌈√n⌉. For n = 100, that gives 10 bins.
- Freedman-Diaconis rule: bin width = 2·IQR / n^(1/3), where IQR is the interquartile range. This adapts to the data’s spread.
For small datasets (n < 30), 5–7 bins usually work well. For larger datasets, 10–20 bins are typical. The calculator lets you experiment with different bin counts to see how the shape changes.
Common Mistakes and How to Avoid Them
One frequent mistake is using unequal bin widths. A histogram requires equal-width intervals; if you use unequal widths, the bar heights are not comparable. Another error is misplacing boundary values: a value exactly on a boundary should go into the bin to the right, except the last bin includes the maximum. Always label axes clearly with the variable name and units.
Rounding errors can also mislead. If you round data before binning, you may create artificial gaps or spikes. Keep raw data and round only the final labels.
Reading a Histogram: Shape, Center, Spread
When you look at a histogram, first describe the overall shape: symmetric, skewed left (tail on the left), skewed right (tail on the right), or uniform. Then note the center: the bin with the highest frequency (the mode) or the median bin. Finally, assess spread: how wide the bars extend. Outliers appear as isolated bars far from the main body.
For example, a symmetric histogram with a single peak suggests a normal distribution. A histogram with two peaks indicates a bimodal distribution, which often means two different groups are mixed in the data.
Limitations of Histograms
A histogram loses exact data values; you only see counts per bin. It also depends heavily on the chosen bin width—the same data can look different with different bin counts. For small datasets, the shape may be unreliable. If you need to compare two distributions, use a frequency polygon or a box plot instead.
Also, histograms are not suitable for categorical data. For categories, use a bar chart with gaps between bars.
Frequently Asked Questions
What is the difference between a histogram and a bar chart?
A histogram displays continuous numerical data with equal-width bins and bars that touch (unless a bin is empty). A bar chart displays categorical data with gaps between bars, and the order of bars can be rearranged.
Can a histogram have negative frequencies?
No. Frequencies are counts, so they are always zero or positive integers. If you see a negative value, it is an error in calculation.
How do I convert frequencies to relative frequencies?
Divide each frequency by the total number of data points (n). The resulting proportions sum to 1. A relative frequency histogram has the same shape but the y-axis shows proportions instead of counts.
What does a skewed histogram tell me?
A right-skewed histogram has a long tail on the right, meaning most values are low but a few are very high (e.g., income data). A left-skewed histogram has a long tail on the left, meaning most values are high but a few are very low (e.g., exam scores with a ceiling effect).
Why do some histograms have gaps between bars?
Gaps occur when a bin has zero frequency—no data points fall in that interval. This is normal and indicates a range with no observations, not a mistake.
Can I use a histogram for discrete data like counts?
Yes, but be careful: if the data are integers, choose bin boundaries that avoid splitting values (e.g., bins 0–4, 5–9, etc.). Otherwise, a bar chart of the counts may be clearer.
Related
Formula used
in d | Data values | - | 1, 2, 2, 3, 3, 3, 4, 4, 5 | 0 in b | Number of bins | - | 5 | 1 out freq | Frequency per bin | - | hist(d, b) | 0 out breaks | Bin boundaries | - | breaks(d, b) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.