Tutorials › AP Statistics › Side-by-Side Bar Charts for Two Groups

Graphs for categorical data · Tutorial 49 of 1000

Side-by-Side Bar Charts for Two Groups

Build and interpret side-by-side bar charts to compare the categorical distributions of two groups using counts or relative frequencies.

Beginner 9 min read

What You'll Learn

  • Arrange each response category’s bars next to one another, with consistent labels and a clear group key.
  • Decide whether counts or relative frequencies best answer the comparison question.
  • Calculate and graph relative frequencies using each group’s own total.
  • Compare category patterns across groups using counts or percentage-point differences.
  • Identify how unequal group sizes can affect the appearance and interpretation of a count chart.

Comparing the Same Categories Across Two Groups

A bar chart can show the distribution of one categorical variable for one group. When you want to compare that distribution across two groups, a side-by-side bar chart places the bars for the groups next to each other for each response category. This arrangement makes it easier to compare the groups category by category.

In Misleading Axes and Scales in Bar Charts, you learned to check the scale and bar design before interpreting a display. For a side-by-side chart, also check that the categories line up across the groups and that a key makes the groups easy to distinguish. The bars should have equal widths, visible gaps between categories, and a vertical scale that starts at zero.

Definition: A side-by-side bar chart displays the counts or relative frequencies for categories of a categorical variable in two or more groups. For each response category, the group-specific bars are placed next to each other so their heights can be compared.

For example, a survey might record a preferred activity and the age group of each respondent. The activity is the response category being compared, and age group separates the data into groups. The horizontal axis lists the activity categories. Within each activity, one bar represents each age group; a legend identifies which bar belongs to which group.

The category order should be the same for both groups. If categories have a natural order, such as “never,” “sometimes,” and “often,” preserve it. Otherwise, choose a clear order and use it consistently. Keep the group colors or patterns consistent throughout the chart and explain them in a legend.

Choose Counts or Relative Frequencies

A side-by-side chart can display counts or relative frequencies. Counts answer questions about how many individuals in each group fall into each category. Relative frequencies show what fraction or percentage of each group falls into each category.

The choice matters when the groups have different numbers of individuals. A larger group may have larger counts in several categories simply because more individuals were surveyed. If the goal is to compare the groups’ distributions, use relative frequencies calculated separately within each group. This is the same denominator idea used in the earlier tutorials on conditional distributions and choosing the correct denominator.

Formula: For a response category in a group, divide that category’s count by the group’s total. To express the relative frequency as a percentage, multiply by \(100\%\).
$$ \text{Relative frequency within a group} = \frac{\text{count in the category for that group}}{\text{total count for that group}} $$

When the chart uses relative frequencies, all bars use the same vertical scale, often from \(0\%\) to \(100\%\). Within each group, the relative frequencies across all response categories add to \(100\%\), allowing a direct comparison of the groups’ distributions. In a count chart, by contrast, each group’s category counts add to that group’s total.

A count chart is useful when the question concerns numbers of individuals or when group sizes are similar and the comparison of counts is meaningful. A relative-frequency chart is usually more informative for comparing how responses are distributed when group sizes differ. As in Comparing Conditional Percentages in Context, describe differences in percentages as percentage-point differences.

How to Build a Side-by-Side Bar Chart

Start with a frequency table that lists the same response categories for each group. Check that every individual is counted once in an appropriate category, and that each group’s category counts add to its group total. If you are comparing relative frequencies, divide each count by its own group total before drawing the bars.

1
Identify the groups and response categories.
Label the two groups being compared and list the categories of the categorical response variable in a consistent order.
2
Choose the bar heights.
Use counts to compare numbers of individuals or relative frequencies to compare distributions, especially when group sizes differ.
3
Choose and label a vertical scale.
Start at zero. Use counts or percentages as appropriate, with evenly spaced tick marks that cover the largest value.
4
Draw the grouped bars and key.
For each response category, draw equal-width bars next to each other, one per group. Use a consistent visual key and leave a gap before the next category.
5
Title and label the chart.
Name the response variable, the groups, and whether bar heights represent counts or relative frequencies.

The side-by-side arrangement keeps the comparison focused on a response category: look across the neighboring bars to compare the groups for that category. Then move to another category. Do not confuse this with comparing categories within just one group; both comparisons can be useful, but they answer different questions.

Worked Example: Build a Count Chart

Worked Example: Build a Count Chart

A fictional community survey asks 30 teenagers and 30 adults which garden activity they most enjoy. The results are shown below. How would you organize a side-by-side bar chart, and what does it show?

Favorite activityTeenagersAdults
Planting149
Watering1012
Harvesting69
Total3030

First, check the group totals. The teenagers’ counts add to \(14+10+6=30\), and the adults’ counts add to \(9+12+9=30\). The two groups have equal sizes, so counts can be compared directly here.

Put Planting, Watering, and Harvesting on the horizontal axis. For each activity, draw a teenager bar and an adult bar beside it. Label the vertical axis “Number of respondents” and choose a scale starting at zero that reaches at least 14; for instance, evenly spaced marks from 0 to 16. Add a legend identifying the two groups.

Compare the neighboring bars for each activity. For Planting, 14 teenagers and 9 adults chose the activity, a difference of \(14-9=5\) respondents. For Watering, 12 adults and 10 teenagers chose it, a difference of \(12-10=2\). For Harvesting, 9 adults and 6 teenagers chose it, a difference of \(9-6=3\).

In this sample, Planting has the largest count among teenagers, while Watering has the largest count among adults. Because each group contains 30 respondents, the count comparisons also reflect the relative-frequency pattern. The chart describes these respondents; it does not by itself establish why their preferences differ.

Worked Example: Use Relative Frequencies When Group Sizes Differ

Worked Example: Use Relative Frequencies When Group Sizes Differ

A fictional library survey records preferred reading format among 40 weekday visitors and 80 weekend visitors. Should a chart comparing the groups’ distributions use counts or relative frequencies? Calculate the relative frequencies and interpret the comparison.

Preferred formatWeekday countWeekend count
Print2028
Digital1232
Audiobook820
Total4080

The group sizes differ, so raw counts alone could make the weekend bars look larger because twice as many weekend visitors were surveyed. To compare the distributions, divide each count by its own group total.

$$ \begin{aligned} \text{Weekday: }& \frac{20}{40}=0.50=50\%,\quad \frac{12}{40}=0.30=30\%,\quad \frac{8}{40}=0.20=20\%\\ \text{Weekend: }& \frac{28}{80}=0.35=35\%,\quad \frac{32}{80}=0.40=40\%,\quad \frac{20}{80}=0.25=25\% \end{aligned} $$

Each group’s percentages add to \(100\%\): for weekday visitors, \(50\%+30\%+20\%=100\%\); for weekend visitors, \(35\%+40\%+25\%=100\%\). Draw the three reading-format categories on the horizontal axis, with a weekday and weekend bar next to each category. Label the vertical axis “Percent of visitors,” use a scale from \(0\%\) to \(100\%\), and include a clear key.

Among weekday visitors, \(50\%\) preferred print, compared with \(35\%\) of weekend visitors, a difference of \(15\) percentage points. Digital preference was \(30\%\) for weekday visitors and \(40\%\) for weekend visitors, a difference of \(10\) percentage points in the other direction. Audiobook preference was \(20\%\) and \(25\%\), respectively, a difference of \(5\) percentage points.

The count chart would show 28 weekend visitors choosing print and 20 weekday visitors choosing print. The relative-frequency chart makes the group comparison clearer: print accounts for a larger share of weekday visitors, while digital accounts for a larger share of weekend visitors. These are descriptions of the surveyed groups, not evidence that visiting on a particular day causes a preference.

Worked Example: Read a Side-by-Side Chart in Context

Worked Example: Read a Side-by-Side Chart in Context

A fictional school survey compares 60 Grade 10 students with 60 Grade 12 students on their preferred study location. A side-by-side count chart represents these results:

Study locationGrade 10Grade 12
Library1824
Home3021
Café1215
Total6060

What is the most common response in each group, and how does the percentage choosing the library compare? The tallest Grade 10 bar is Home, at 30 students. The tallest Grade 12 bar is Library, at 24 students. Thus, the most common location differs between these groups.

To compare the library shares, use each grade’s total as the denominator:

$$ \text{Grade 10 library percentage} = \frac{18}{60}\times100\%=30\% $$
$$ \text{Grade 12 library percentage} = \frac{24}{60}\times100\%=40\% $$

The Grade 12 library percentage is \(40\%-30\%=10\) percentage points higher than the Grade 10 percentage. The chart can communicate both the counts and, because the group totals are equal, the same comparison in relative-frequency terms. A complete interpretation names the groups, the category, and the measured difference: in this survey, the percentage preferring the library was 10 percentage points higher among Grade 12 students than among Grade 10 students.

Common Mistakes and What a Strong Answer Says

  • Using counts to compare unequal group sizes without noting the limitation. Larger groups often have larger counts. If the question is about distributions, calculate each group’s relative frequencies and compare those instead.
  • Using the grand total as the denominator for a group percentage. To find the percentage within one group, divide by that group’s total, not the total across both groups. State the group and category so the denominator is clear.
  • Comparing bars from different categories as if they answer the same question. First compare the adjacent group bars within one category. Then, if useful, describe the most common category within each group.
  • Leaving the group key or measurement unclear. Label the groups and say whether heights represent counts or percentages. Without those details, a reader may not know what a bar means.
  • Calling a percentage difference a percent difference. Subtracting \(40\%\) and \(30\%\) gives a difference of 10 percentage points. A strong answer identifies it that way and names the groups and category.
  • Claiming that a chart proves a cause. A side-by-side chart displays patterns in the data. As in the earlier tutorial on association between categorical variables, differences in distributions may show an association in the observed data, but the graph alone does not establish causation.

A strong comparison does more than say that one bar is taller. It names the category and both groups, gives the relevant counts or percentages, and describes the difference in context. If group sizes are unequal, it uses within-group relative frequencies when comparing distributions.

Key takeaway: A side-by-side bar chart places group-specific bars next to each other for each response category. Use counts to compare numbers and within-group relative frequencies to compare distributions, especially when group sizes differ. Label the groups and the scale, then describe the pattern in context.

Check Your Understanding

Use the group totals and response categories carefully when answering.

  1. A chart compares two groups across the categories Red, Blue, and Green. Where should the bars for each group appear, and what should the key explain?
  2. Group A has 12 “yes” responses out of 30; Group B has 20 “yes” responses out of 80. Find each group’s percentage of “yes” responses and state the percentage-point difference.
  3. Why might a count chart make a larger group appear to have a stronger preference even if the groups’ relative frequencies are similar?
  4. In one group, category counts are 9, 15, and 6. What is the group total, and what percentage is in the category with count 15?
  5. Write a contextual sentence comparing a category’s percentages of \(35\%\) and \(42\%\) in two named groups. Use “percentage points” correctly.