Tutorials › Introduction to Statistics › 100% Stacked Bars and Within-Group Proportions

Graphs for Categorical Data · Tutorial 111 of 996

100% Stacked Bars and Within-Group Proportions

Convert each group’s counts to within-group percentages and use 100% stacked bars to compare category compositions without confusing them with group sizes.

Beginner 9 min read

What You'll Learn

  • Calculate each category’s within-group proportion and percentage using the correct group total.
  • Check that percentages within each group add to 100%, allowing for rounding.
  • Construct a 100% stacked bar chart with one equal-length bar per group.
  • Compare category compositions across groups while distinguishing percentages from counts.
  • Recognize what information a 100% stacked bar chart does not show.

Why Make Every Bar 100%?

A stacked bar chart displays category counts as segments, so the total height of a bar reflects the number of observations in that group. When groups have different sizes, taller bars can make comparisons of category composition difficult: a segment may be larger simply because its group contains more observations. A 100% stacked bar chart changes the scale so every bar has the same total length. Its segments represent the percentages of observations in each group that fall into the categories.

For example, suppose a hypothetical survey records how students travel to campus in two groups, residents and commuters. If there are many more commuters than residents, the commuter bar in a count-based stacked chart may be much taller. That does not by itself tell us whether commuters are more likely to choose any particular travel mode. Comparing within-group percentages answers a different, more focused question: What is the composition of each group?

Definition: For a group with \(n\) valid observations, the within-group proportion for a category is its count divided by the group total. The corresponding within-group percentage is that proportion multiplied by 100. A 100% stacked bar chart represents each group with a bar of equal total length, divided into category segments according to those within-group percentages.

Calculate Within-Group Percentages

Let \(c_{ij}\) be the count in category \(i\) for group \(j\), and let \(n_j\) be the total number of valid observations in group \(j\). The within-group proportion is \(c_{ij}/n_j\). To express it as a percentage, multiply by 100.

$$ \text{Within-group proportion}=\frac{c_{ij}}{n_j} \qquad \text{Within-group percentage}=\frac{c_{ij}}{n_j}\times 100\% $$

The denominator is the total for the group in which the category count occurs—not the total across all groups. If the categories account for every valid observation in the group, their counts add to \(n_j\), and their percentages add to 100%. This gives a useful check on the calculation and explains why every bar in the chart has the same total length.

$$ \sum_i \frac{c_{ij}}{n_j} = \frac{\sum_i c_{ij}}{n_j} = \frac{n_j}{n_j} = 1 $$

The equality holds because, for a given group, the category counts together equal its total \(n_j\). Multiplying each proportion by 100 expresses the same result as percentages summing to 100%. If the displayed percentages differ slightly from 100% because they have been rounded, the unrounded values still sum to 100%.

Worked Example: Convert Counts to Percentages

In a hypothetical survey, 80 first-year students report their usual mode of travel to campus. The counts are 32 by bus, 24 walking, 8 by bicycle, and 16 by car. Convert each count into a within-group percentage.

Step 1: Identify the group total. There are \(32+24+8+16=80\) valid responses, so \(n=80\).

Step 2: Divide each category count by 80 and multiply by 100.

$$ \begin{aligned} \text{Bus: }&\frac{32}{80}\times100\%=40\%\\ \text{Walking: }&\frac{24}{80}\times100\%=30\%\\ \text{Bicycle: }&\frac{8}{80}\times100\%=10\%\\ \text{Car: }&\frac{16}{80}\times100\%=20\% \end{aligned} $$

Step 3: Check the result. The percentages add to \(40\%+30\%+10\%+20\%=100\%\). In a 100% stacked bar, the first-year students’ bar would therefore consist of segments of 40% bus, 30% walking, 10% bicycle, and 20% car. The percentages describe the distribution within this group; they do not say how many students are in another group.

Build and Read the Chart

To make a 100% stacked bar chart, calculate the within-group percentage for each category, then draw one bar for each group on a shared scale from 0% to 100%. Divide each bar into segments whose lengths match the category percentages. Use the same category order and colors in every bar, and label the groups, categories, and percentage scale clearly. If bars are horizontal, each bar extends from 0% to 100% along the horizontal axis; if vertical, it extends along the vertical axis.

Each bar has equal length, regardless of how many observations its group contains. The segment boundaries show the cumulative percentages of the categories in the chosen order. For instance, if the categories are ordered bus, walking, bicycle, car and a group has percentages 40%, 30%, 10%, and 20%, its successive boundaries are at 40%, 70%, 80%, and 100%. Use the same category order in every bar so corresponding segments can be compared.

Worked Example: Compare Groups of Different Sizes

A hypothetical survey asks students about their usual travel mode. Among 40 morning-class students, 18 choose bus, 14 choose walking, and 8 choose bicycle. Among 100 evening-class students, 30 choose bus, 50 choose walking, and 20 choose bicycle. Compare the group compositions.

Morning group: The counts add to 40. The percentages are \(18/40\times100\%=45\%\) bus, \(14/40\times100\%=35\%\) walking, and \(8/40\times100\%=20\%\) bicycle. They sum to 100%.

Evening group: The counts add to 100. The percentages are \(30/100\times100\%=30\%\) bus, \(50/100\times100\%=50\%\) walking, and \(20/100\times100\%=20\%\) bicycle. They also sum to 100%.

In the chart, each group has an equal-length bar. The bus segment is 45% of the morning bar and 30% of the evening bar; the walking segment is 35% and 50%, respectively; bicycle accounts for 20% of each. Thus, the morning group has a larger percentage choosing bus, the evening group has a larger percentage choosing walking, and the bicycle percentages are equal.

The counts tell a different part of the story: 30 evening students chose bus, compared with 18 morning students. This does not contradict the percentage comparison. The evening group is larger, while bus represents a greater share of the morning group. A 100% stacked bar chart makes the shares easy to compare but does not show the original group sizes.

What the Display Shows—and What It Hides

The central purpose of this display is to compare category composition across groups. It can make differences in percentages visible even when the groups have unequal totals. It is a descriptive graph: it summarizes the observed counts and, by itself, does not establish why groups differ or whether a difference would persist beyond the observations collected.

Equal bar lengths also mean that the chart does not communicate group size directly. A segment covering 40% of a group of 25 represents 10 observations, while a segment covering 40% of a group of 250 represents 100. If group sizes matter to the reader, report them alongside the graph, for example in labels or a nearby summary. Do not treat equal-sized bars as evidence that the groups contain equal numbers of observations.

Check that each observation contributes to exactly one displayed category within its group. The percentages sum to 100% when the categories are mutually exclusive and collectively account for all valid observations. If responses can be assigned to several categories, adding their counts may exceed the group total, and the resulting percentages will not form a 100% composition. Similarly, if some observations are missing, the denominator must be defined consistently: a percentage among valid responses uses the number of valid responses in that group. State clearly what was included.

Worked Example: Check Rounding and Interpret a Boundary

In a hypothetical survey, 24 students in one group choose among three options: 7 select option A, 11 select option B, and 6 select option C. Calculate the percentages and describe the boundaries for a bar ordered A, B, C.

The counts sum to \(7+11+6=24\), so the group total is 24. The percentages are:

$$ \begin{aligned} \text{A: }&\frac{7}{24}\times100\%\approx29.17\%\\ \text{B: }&\frac{11}{24}\times100\%\approx45.83\%\\ \text{C: }&\frac{6}{24}\times100\%=25.00\% \end{aligned} $$

The displayed percentages sum to \(29.17\%+45.83\%+25.00\%=100.00\%\). The boundary after A is at about 29.17%. The boundary after B is at about \(29.17\%+45.83\%=75.00\%\), and the last segment ends at 100%. A reader can interpret the first segment as showing that about 29.17% of this group selected A.

Percentages rounded to fewer decimal places might not sum exactly to 100. For example, rounding each segment separately to whole percentages gives 29%, 46%, and 25%, which still sum to 100% here. In other data, rounding may give a displayed total of 99% or 101%. That small discrepancy is a rounding effect, not a reason to alter the underlying counts. Use the unrounded proportions for the chart’s segment lengths, and report the rounding convention if the labels do not add exactly to 100%.

A Reliable Construction Process

A consistent process helps prevent denominator errors and makes a chart easier to read.

1
Confirm the groups and categories.
Ensure the counts refer to the same variable and that each valid observation belongs to one category within its group.
2
Find each group total.
Add the category counts separately for each group. These group-specific totals are the denominators.
3
Calculate and check percentages.
For each category, divide its count by its own group total and multiply by 100. Check that the percentages within each group sum to 100%, allowing for rounding.
4
Draw and label equal-length bars.
Use a percentage scale from 0% to 100%, a consistent category order, and clear group and category labels. Include group sizes when those sizes are important to the comparison.

Common Mistake

A frequent error is to divide every category count by the grand total across all groups. That produces each category’s share of the combined data, not its percentage within its own group. Those values generally do not add to 100% separately for each group, so they cannot correctly define equal-length 100% stacked bars.

For example, the morning bus count in the earlier example is 18, and the combined total across both groups is 140. Dividing \(18\) by \(140\) gives about 12.86%, but this is not the percentage of morning students choosing bus. The correct denominator is the morning group total, 40, so \(18/40\times100\%=45\%\). Always match each category count to the total for its own group.

Key takeaway: In a 100% stacked bar chart, each group is scaled to 100%, and each category segment represents its percentage within that group. Use group-specific totals as denominators, check that each group’s percentages sum to 100%, and remember that equal-length bars do not show group size.

Check Your Understanding

Try these questions without looking back.

  1. A group has 12 responses in category A and 28 in category B. What is the within-group percentage in each category, and how can you check your calculations?
  2. Why must the denominator for a category percentage in a 100% stacked bar chart be the total for that category’s group?
  3. Two groups have different sample sizes, but category A represents 35% of each. What can you conclude about the category percentages, and what can you not conclude about the counts?
  4. What does the 100% stacked bar chart make easier to compare than a count-based stacked bar chart? What information does it make less visible?
  5. A set of responses allows each person to choose several categories, so the category counts sum to more than the number of people. Why might those counts not produce a 100% composition?