Tutorials › Introduction to Statistics › Side-By-Side Histograms for Group Comparisons

Comparing Groups and Handling Outliers · Tutorial 179 of 996

Side-By-Side Histograms for Group Comparisons

Learn how to choose shared bins and aligned axes so side-by-side histograms support fair comparisons, and how to check whether a pattern depends on bin choice.

Beginner 10 min read

What You'll Learn

  • Define common, adjacent histogram bins for comparing groups
  • Count observations consistently at bin boundaries
  • Align horizontal and vertical axes for meaningful visual comparisons
  • Build and interpret side-by-side histograms from hypothetical data
  • Recognize how bin width and bin starting point can change an apparent pattern
  • Check whether a graph’s apparent features are robust to reasonable bin choices

Why Use Side-by-Side Histograms?

When two groups have measurements on the same quantitative scale, separate histograms placed next to one another can make their distributions easier to compare. A reader can look across the panels and see where observations are concentrated, how widely they are spread, and whether either group has an unusual shape. The comparison is useful only if the graphs use compatible scales and bins: otherwise, a visual difference may come from the way the histograms were drawn rather than from the data.

This tutorial focuses on a practical rule: use the same bin widths and the same bin boundaries for every group, and align the axes. Then a bar in one panel represents the same range of measurement values as the bar directly beside it in another panel.

Definition: A histogram displays a quantitative variable by dividing its measurement scale into adjacent intervals called bins. Each bar represents the observations falling in one bin. In a frequency histogram, the bar height is the number of observations in that bin. In a side-by-side histogram, separate panels display different groups using the same horizontal scale and, when comparing frequencies, the same vertical scale.

A bin is identified by its boundaries. For example, the bins \([0,10)\) and \([10,20)\) cover values from 0 up to, but not including, 10, and from 10 up to, but not including, 20. This convention assigns a value exactly on a boundary to one bin only. If the last bin includes the upper endpoint, state or apply that rule consistently. Since the variable is quantitative, histogram bars for adjacent bins touch: the intervals meet along a continuous measurement scale.

For a fair group comparison, each panel should use the same measurement units, horizontal range, bin width, bin boundaries, and vertical scale. These are display choices, not assumptions about a probability model. A histogram describes the observations collected; by itself, it does not establish why groups differ or whether a difference is caused by group membership.

Building a Shared Set of Bins

Start by identifying the range that needs to be shown across all groups. Choose a bin width that gives a readable summary without hiding important detail or producing a mass of nearly empty bars. Place the boundaries once, then use that identical set in every panel. Count each observation into exactly one bin.

With equal-width bins, frequency bar heights can be compared directly: equal heights mean equal numbers of observations in those ranges. When group sample sizes are equal, frequency heights also compare in the same way as within-group percentages. If sample sizes differ, raw frequencies can reflect group size as well as distribution shape; the vertical scale and the question being asked need careful attention. The detailed comparison of unequal sample sizes is a separate issue, but a graph should never hide which quantity its vertical axis represents.

1
Set a common horizontal range.
Include the relevant values from every group, with the same endpoints and units in each panel.
2
Choose and align bin boundaries.
Use one bin width and one starting point for all groups. Write down the interval convention for values on boundaries.
3
Count each group separately.
For each bin, count the observations from that group that fall inside its interval. Check that all bin counts add to that group's sample size.
4
Draw aligned panels and compare.
Use the same vertical scale for frequency comparisons, label axes and units, and describe the visible patterns without treating the graph as evidence of causation.

Worked Example: Comparing Trail Completion Times

Suppose two hypothetical groups of hikers complete the same trail. Their completion times, in minutes, are:

Group A: 12, 15, 18, 22, 24, 27, 31, 34, 36, 38
Group B: 6, 9, 14, 16, 19, 21, 23, 25, 28, 30

There are 10 observations in each group, and every time is recorded in minutes. Use the shared bins \([0,10)\), \([10,20)\), \([20,30)\), and \([30,40)\). These have a common width of 10 minutes and cover all the observations. The left endpoint is included and the right endpoint excluded, so the value 30 belongs in \([30,40)\).

For Group A, the first bin contains none of the times. The second contains 12, 15, and 18, giving 3. The third contains 22, 24, and 27, also giving 3. The fourth contains 31, 34, 36, and 38, giving 4.

For Group B, 6 and 9 fall in the first bin, giving 2. The second contains 14, 16, and 19, giving 3. The third contains 21, 23, 25, and 28, giving 4. The fourth contains 30, giving 1.

Completion time (minutes)Group A frequencyGroup B frequency
[0, 10)02
[10, 20)33
[20, 30)34
[30, 40)41
Total1010

Draw two adjacent panels with the same horizontal axis from 0 to 40 minutes and the same frequency axis, for example from 0 to 4. In each panel, draw touching bars of width 10 minutes with heights from the table. The shared bins make direct comparisons possible: for instance, 4 Group A hikers and 1 Group B hiker are in the 30-to-under-40-minute interval. The counts in each column add to 10, as required. These histograms summarize these hypothetical observations; they do not show that group membership caused the difference.

What the Shared Axes Accomplish

The horizontal axis establishes the value represented by each position. If one panel runs from 0 to 40 minutes and the other from 10 to 50, bars at the same horizontal location do not represent the same times. Likewise, using bins \([0,10)\), \([10,20)\), and so on in one group but \([5,15)\), \([15,25)\), and so on in another makes direct bar-by-bar comparison invalid. The bars refer to different intervals even if they happen to look similar.

The vertical axis also needs attention. When comparing frequencies, a common vertical scale is essential: a bar of height 4 should have the same plotted height in each panel. If each panel is independently stretched to fill the same height, the tallest bar in both panels looks equally tall even when the groups have different bin counts. Clearly labeled axes help a reader distinguish a genuine comparison from a visual artifact.

The intervals themselves are part of the comparison. In a frequency histogram, a bar’s height is a count, not a separate score assigned to the interval. With common bin widths, equal bar heights correspond to equal counts in equal-sized ranges. If widths vary, interpreting heights alone as counts is not appropriate; for this tutorial’s comparisons, keep widths equal.

Worked Example: A Shifted Starting Point Changes the Picture

Consider one hypothetical group with values 1 through 10, each observed once. Compare two reasonable-looking choices of equal-width bins. First use boundaries 0, 5, 10, and 15:

The bins \([0,5)\), \([5,10)\), and \([10,15)\) have counts 4, 5, and 1. The first contains 1, 2, 3, and 4; the second contains 5, 6, 7, 8, and 9; the third contains 10.

Now keep the width at 5 but shift the boundaries by 2.5 units, using \([-2.5,2.5)\), \([2.5,7.5)\), and \([7.5,12.5)\). The counts are 2, 5, and 3: the bins contain 1 and 2; then 3 through 7; then 8 through 10.

Both sets of bins cover all 10 observations and use width 5. Yet the first set shows a final bar of height 1, while the shifted set shows a final bar of height 3. The data have not changed; the grouping into intervals has. Thus, an apparent rise, drop, gap, or concentration near a bin boundary can depend on where the boundaries are placed. When a visible feature matters, check whether it persists under another sensible bin placement rather than relying on one layout alone.

Checking a Group Comparison

A side-by-side histogram should make its construction easy to verify. Confirm that the horizontal axes use the same units and endpoints, that corresponding bins have identical boundaries, and that the vertical axes are aligned and labeled. Then check the arithmetic: the bin frequencies for each group should sum to its number of observations. A mismatch may indicate a missed value, a value counted twice, or a boundary handled inconsistently.

Once the graph is checked, describe what its bars show in the measurement’s context. You might note which intervals contain more observations in one group, or whether one group’s observed values extend across a wider range. Keep the description tied to the chosen bins: a histogram does not reveal the exact positions of observations within each bin. It is a grouped display, and changing the grouping can change the detail it shows.

Worked Example: Why the Vertical Scale Must Match

Two hypothetical groups each have 8 measurements, with values in the same units. Using common bins \([0,10)\), \([10,20)\), \([20,30)\), \([30,40)\), and \([40,50)\), suppose Group A has frequencies 1, 2, 1, 2, 2 and Group B has frequencies 1, 1, 2, 1, 3. Each set sums to 8.

For Group A, the largest count is 2; for Group B, it is 3. If each panel is scaled independently so its tallest bar reaches the top of the plotting area, the bar of height 2 in Group A and the bar of height 3 in Group B would both reach that top. The display would conceal the difference in counts. Instead, use a shared vertical axis that reaches at least 3, such as 0 to 3, for both panels. Then the tallest bar in Group B is visibly higher, while the bin boundaries still identify the same ranges.

This choice answers a question about counts. If the goal were to compare within-group proportions, the plotted quantity would need to be identified as proportions rather than frequencies. In this example the sample sizes happen to be equal, so dividing each count by 8 gives comparable proportions; the frequency and proportion bars would have the same relative pattern. Whatever quantity is displayed, the axis label and scale must make it clear.

Common Mistakes and a Practical Check

  • Using different bin boundaries across groups. Bars cannot be compared directly if they summarize different ranges. Choose one shared set of intervals before counting.
  • Changing the horizontal range or zoom between panels. A shared position on the page must correspond to the same measurement value. Align endpoints and units.
  • Scaling each frequency axis separately. A visually tall bar may represent fewer observations if the panel uses a different scale. Use one vertical scale for frequency comparisons.
  • Assuming a pattern is fixed by the data. Different bin widths or starting points can emphasize or obscure features. Check whether the important pattern remains under sensible alternatives.
  • Forgetting boundary values. State a consistent endpoint rule so values on a boundary are counted once, not omitted or assigned to two bins.
Key takeaway: To compare groups with side-by-side histograms, use common bin widths, identical boundaries, aligned horizontal axes, and a shared vertical scale for the quantity being compared. Treat visible details cautiously when they change under reasonable bin choices.

Check Your Understanding

Use these questions to check whether you can construct and evaluate side-by-side histograms.

  1. Two groups have measurements in centimeters. Why should their side-by-side histograms use the same bin boundaries and horizontal range?
  2. Using bins \([0,10)\) and \([10,20)\), which bin contains a measurement of exactly 10? State the boundary convention that determines your answer.
  3. Why can independently scaled frequency axes make a comparison misleading, even if both vertical axes are labeled?
  4. A single group is graphed first with bins from 0 to 5 to 10 to 15, and then with bins from 2.5 to 7.5 to 12.5. What has changed, and what has not changed?
  5. What arithmetic check should be done on the bin counts in each panel, and what should the total equal?