Two charts that look alike but answer different questions
A bar chart shows one value for each category, such as the number of students who chose each of four sports. The categories are labels, so their order on the axis is usually arbitrary and can be rearranged. Bars are drawn with gaps to show that the categories are separate.
A histogram shows how a numeric variable is spread out, such as the heights of 100 students. The horizontal axis is a number line cut into bins. Bars touch because one bin ends exactly where the next begins.
How each chart is built
For a bar chart, count or total the values in each category and draw a bar whose length matches that value. The bars should start at zero, because length is the thing the eye compares.
For a histogram, choose bin edges, then count how many observations fall in each bin. Bins are usually given equal width. A common convention puts the left edge in the bin and the right edge in the next bin, so a value of 20 belongs to 20 to 30. The bar height shows the count, or the frequency density when widths differ.
Worked example with unequal bins
Suppose 50 people are grouped by age: 0 to 10 has 10 people, 10 to 20 has 15, and 20 to 40 has 25. The counts add to 10 + 15 + 25 = 50. The last bin is 20 wide, twice the others, so its height must be adjusted.
Frequency density is frequency divided by bin width. The heights are 10 / 10 = 1, 15 / 10 = 1.5, and 25 / 20 = 1.25. In this version the area of each bar represents its frequency: 1 × 10 = 10, 1.5 × 10 = 15, and 1.25 × 20 = 25. Using raw counts as heights would make the wide bin look too large.
Common misconceptions
One mistake is thinking the two charts are interchangeable. A histogram of a numeric variable shows shape, such as symmetry, skew, or several peaks. A bar chart of categories has no shape in that sense.
Another mistake is believing the bin choice does not matter. Very narrow bins give a jagged picture, and very wide bins hide detail. A third is that the bar height is always the count. With unequal bin widths, area should represent frequency.
Where each one appears
Bar charts are used for survey answers, sales by region, or counts by blood type. Histograms are used for exam scores, measurement errors, waiting times, and checking whether data looks roughly like a normal distribution. In statistics courses, the histogram is often the first step before choosing a model or summary statistic.
Key terms
- Bin
- An interval of values on a histogram's horizontal axis into which observations are counted.
- Frequency
- The number of observations in a category or bin.
- Frequency density
- Frequency divided by bin width, used as bar height when bins differ in width.
- Categorical variable
- A variable whose values are labels or groups rather than measured numbers.
- Continuous variable
- A numeric variable that can take any value in a range, such as height or time.
- Distribution
- The pattern showing how often different values of a variable occur.
