From a Two-Way Table to a 100% Bar for Each Group
In Reading a Segmented Bar Chart, you learned that each bar represents \(100\%\) of one group and that each segment shows the percentage of that group in a response category. Now we will construct that display from a two-way table. The essential first step is to calculate the conditional distribution of responses separately for every group.
A two-way table provides counts, not segment heights. To make a segmented bar chart, use each group’s total as the denominator for that group’s percentages. This is the conditional percentage approach from the earlier tutorials on conditional distributions and choosing the correct denominator. Do not divide every cell by the grand total: that would give joint percentages for the whole table, not the within-group percentages needed for the bars.
For example, if a group has 40 individuals and 18 are in a particular response category, that segment represents \(\frac{18}{40}\times100\%=45\%\) of the group. The bar for that group will have a segment covering 45 percentage points of its full 100-percentage-point height.
A Step-by-Step Construction Routine
Before drawing, decide which variable defines the groups and which variable supplies the response categories. The group categories become the separate bars; the response categories become the segments within each bar. Choose one segment order and use that same order in every bar. If the response categories have a meaningful order, preserve it. Otherwise, choose a clear order and keep it consistent.
Identify the group categories, response categories, cell counts, and total for each group. Check that the counts in each group add to its total.
For every cell, divide by the total for the group represented by its bar. Multiply by \(100\%\). Do not use the grand total as the denominator.
Check that the percentages for each group add to \(100\%\). Choose the same bottom-to-top response-category order for every bar.
Make a percentage axis from \(0\%\) to \(100\%\). Draw equal-width bars, divide each one according to its group’s percentages, and label the groups and response categories.
The drawing uses cumulative boundaries. If the bottom segment is \(45\%\), its top boundary is at \(45\%\). If the next segment is \(35\%\), its top boundary is at \(45\%+35\%=80\%\). The final segment reaches \(100\%\). This is the same boundary idea you used when reading segmented bars; here, you calculate those boundaries so you can place the segments.
Draw the vertical axis with evenly spaced percentage marks, such as \(0\%, 20\%, 40\%, 60\%, 80\%, 100\%\). Each bar should start at zero and reach the \(100\%\) line. Bars should have equal widths and be separated by gaps, as in a bar chart. Add a title, label the group categories beneath the bars, and include a key or direct labels for the response categories. A reader should not have to guess what a segment’s color or pattern means.
Because all bars reach \(100\%\), this display compares conditional distributions, not the sizes of the groups. Include group totals in a nearby table or label if those sample sizes matter to the reader. If percentages need rounding, keep enough precision to make the segments understandable, and make the top of every bar meet the \(100\%\) line. Small rounding differences do not change the underlying counts.
Worked Example: Build the Chart from Counts
Worked Example: Build the Chart from Counts
A fictional survey of community-garden members asks which reminder format they prefer for work sessions: text message, email, or a posted notice. Members are grouped by how long they have belonged to the garden. Construct the segmented bar chart from the table. Use text message, email, then posted notice from bottom to top.
| Membership group | Text message | Posted notice | Group total | |
|---|---|---|---|---|
| New members | 18 | 14 | 8 | 40 |
| Some experience | 30 | 15 | 5 | 50 |
| Longtime members | 20 | 12 | 8 | 40 |
State. The bars will represent the three membership groups, and the segments will represent the three reminder preferences. Each group’s bar must show its own response distribution as a total of \(100\%\).
Plan. Calculate each response percentage using the total in that row. Then stack the categories in the stated order, starting with text message at the bottom. Check the percentages within each row before plotting.
Do. For new members, the percentages are \(18/40\times100\%=45\%\) for text message, \(14/40\times100\%=35\%\) for email, and \(8/40\times100\%=20\%\) for posted notice. The row adds to \(45\%+35\%+20\%=100\%\). For some-experience members, the percentages are \(30/50\times100\%=60\%\), \(15/50\times100\%=30\%\), and \(5/50\times100\%=10\%\); these add to \(100\%\). For longtime members, they are \(20/40\times100\%=50\%\), \(12/40\times100\%=30\%\), and \(8/40\times100\%=20\%\), also totaling \(100\%\).
To plot the bars, mark the cumulative boundaries from bottom to top. For new members, the text-message segment ends at \(45\%\), the email segment ends at \(45\%+35\%=80\%\), and the posted-notice segment ends at \(100\%\). The corresponding boundaries are \(0\%, 45\%, 80\%, 100\%\). For some-experience members, they are \(0\%, 60\%, 90\%, 100\%\). For longtime members, they are \(0\%, 50\%, 80\%, 100\%\).
| Membership group | Text-message top | Email top | Posted-notice top |
|---|---|---|---|
| New members | 45% | 80% | 100% |
| Some experience | 60% | 90% | 100% |
| Longtime members | 50% | 80% | 100% |
Draw a vertical axis from \(0\%\) to \(100\%\), with equal intervals. Draw three equal-width bars and mark the listed boundaries on the matching bars. Shade or color the intervals consistently: text message from zero to its boundary, email from that boundary to the next, and posted notice from the next boundary to \(100\%\). Label the bars and provide a key.
Conclude. The completed chart represents the conditional preference distribution within each membership group. For instance, the text-message segment is \(60\%\) of the some-experience group, while the same preference is \(45\%\) of the new-member group. The bars have equal total height even though the group totals are 40, 50, and 40.
Worked Example: Keep the Group Denominator Straight
Worked Example: Keep the Group Denominator Straight
A fictional campus travel survey records the usual way students travel to campus. The groups are based on commute distance. Construct the percentages for a segmented bar chart, stacking walking, bicycling, then transit from bottom to top.
| Commute distance | Walk | Bicycle | Transit | Group total |
|---|---|---|---|---|
| Short | 12 | 8 | 20 | 40 |
| Medium | 10 | 15 | 25 | 50 |
| Long | 4 | 8 | 28 | 40 |
For short commutes, divide by 40: walking is \(12/40\times100\%=30\%\), bicycling is \(8/40\times100\%=20\%\), and transit is \(20/40\times100\%=50\%\). For medium commutes, divide by 50: the percentages are \(20\%, 30\%,\) and \(50\%\). For long commutes, divide by 40: they are \(10\%, 20\%,\) and \(70\%\). Each group’s percentages sum to \(100\%\).
The cumulative boundaries are \(0\%, 30\%, 50\%, 100\%\) for short commutes; \(0\%, 20\%, 50\%, 100\%\) for medium commutes; and \(0\%, 10\%, 30\%, 100\%\) for long commutes. Mark those heights in the same response-category order on three equal-width bars.
A tempting but incorrect calculation would divide each cell by the grand total, which is \(40+50+40=130\). For example, \(12/130\times100\%\approx9.2\%\) is the short-commute walkers’ share of all surveyed students, not the walking percentage within the short-commute group. The segment in that group’s bar must be \(12/40\times100\%=30\%\).
The constructed chart shows that walking accounts for a larger percentage of the short-commute group than of the long-commute group: \(30\%-10\%=20\) percentage points. It does not show that the short-commute group contains more walkers in count; the counts are 12 and 4 in this table, respectively, and bar heights alone are not counts.
Worked Example: Round Carefully When Drawing
Worked Example: Round Carefully When Drawing
A fictional survey at two community events asks attendees how they arrived: on foot, by bicycle, or by another method. The counts are below. Construct the percentage distributions and identify the boundaries for bars stacked in that order.
| Event | On foot | Bicycle | Another method | Group total |
|---|---|---|---|---|
| Art event | 9 | 7 | 8 | 24 |
| Music event | 10 | 12 | 8 | 30 |
For the art event, the percentages are \(9/24\times100\%=37.5\%\), \(7/24\times100\%\approx29.2\%\), and \(8/24\times100\%\approx33.3\%\), rounded to one decimal place. Their displayed sum is \(37.5\%+29.2\%+33.3\%=100.0\%\). The boundaries are \(0\%, 37.5\%, 66.7\%, 100\%\), because \(37.5\%+29.2\%=66.7\%\).
For the music event, the percentages are \(10/30\times100\%\approx33.3\%\), \(12/30\times100\%=40.0\%\), and \(8/30\times100\%\approx26.7\%\). They sum to \(100.0\%\). The boundaries are \(0\%, 33.3\%, 73.3\%, 100\%\).
Plot the two bars using a \(0\%\) to \(100\%\) scale and these boundaries. The small decimal values are appropriate for calculation, but a hand-drawn chart may not show tenths of a percent precisely. Label the percentages if that precision matters; otherwise, mark the nearest practical position and keep the top boundary at \(100\%\). Do not let rounding make the final segment stop short of or extend beyond the top of the bar.
Common Mistakes and Strong Construction Choices
- Using the grand total as the denominator. This creates joint percentages rather than the conditional percentages represented by the bars. Use the total for the specific group.
- Mixing count and percentage bars. A segmented bar chart has one bar per group, and every bar reaches \(100\%\). Do not use raw cell counts as segment heights.
- Changing the segment order between bars. Keep the same categories in the same bottom-to-top order so readers can compare the same response across groups.
- Plotting percentages as boundaries without adding them. A \(30\%\) segment followed by a \(20\%\) segment ends at \(50\%\), not \(20\%\). Mark the cumulative boundary.
- Forgetting to check each group’s total. Before drawing, verify that the conditional percentages in each group add to \(100\%\), allowing for small rounding differences.
- Leaving out labels or a key. Clearly name the group categories and identify the response categories shown by the segments. A color alone is not an adequate explanation.
- Suggesting that equal bar heights mean equal group sizes. Every bar is scaled to \(100\%\), regardless of its group’s number of individuals. Keep or display the original group totals when they are important.
A strong construction answer shows the within-group calculations, checks each distribution, and names the categories represented by the bars and segments. When interpreting the finished display, describe percentages as shares of their respective groups. The chart summarizes the data; by itself, it does not establish that group membership caused any differences.
Check Your Understanding
Use each group’s total as the denominator, then think about how the percentages become segment boundaries.
- A group has 25 responses in Category A out of 50 total responses. What percentage of that group belongs in Category A’s segment?
- A group’s segment percentages, from bottom to top, are \(40\%, 35\%,\) and \(25\%\). What are the cumulative boundaries for drawing the bar?
- Why should the grand total not be used as the denominator when constructing each group’s bar?
- A category’s percentages are \(22.2\%, 33.3\%,\) and \(44.4\%\) after rounding to one decimal place. What should you check or account for before drawing the top of the bar?
- Two group bars both reach \(100\%\), but their original totals are 30 and 90. What does the equal bar height tell you, and what does it not tell you?