- Create side-by-side and stacked bar graphs using technology
- Use side-by-side and stacked bar graphs to compare different groups
Comparing a Variable Across Groups
Both pie charts and bar graphs are good visual representations of a categorical variable from a single population or group. But what can we do if we want to compare a categorical variable across multiple groups?
contingency table (two-way table)
A contingency table is a table that displays the results of two categorical variables simultaneously. This is also called a two-way table.
- The advantage of a contingency table is that you can see each precise percentage of responses or frequency of responses.
- A disadvantage is that the table does not present a strong visual comparison between the groups.
Side-by-Side Bar Charts
Side-by-side bar charts and stacked bar charts are extensions of bar graphs or pie charts that allow us to conduct comparisons between multiple data sets. These bar charts will help us to explore how to display and interpret changes in a categorical variable of interest when comparing multiple populations or groups of interest.
side-by-side bar charts
Side-by-side bar charts present data for two categorical variables from more than one group by creating multiple bars on the chart for each group, with one bar for each variable.
| Presidential 2020 Voting Patterns Percentage by Race | |||
| Biden | Trump | Other | |
| White | [latex]41[/latex] | [latex]58[/latex] | [latex]1[/latex] |
| Black | [latex]87[/latex] | [latex]12[/latex] | [latex]1[/latex] |
| Latinx | [latex]65[/latex] | [latex]32[/latex] | [latex]3[/latex] |
| Asian | [latex]61[/latex] | [latex]34[/latex] | [latex]5[/latex] |
| Other | [latex]55[/latex] | [latex]41[/latex] | [latex]4[/latex] |
Among Asians, for example, [latex]61[/latex]% voted for Biden, [latex]34[/latex]% voted for Trump, and the remaining [latex]5[/latex]% voted for someone else.
Translating the table to a visual might aid in the comparison between the groups.
Let’s take the table of voting patterns we looked at above and compare it to a side-by-side bar graph containing the same information.

The groups of interest are listed on the horizontal axis (Whites, Blacks, Latinx, Asian, and Other), and the percentages associated with each voter choice are on the vertical axis.
- Schaul, K., Rabinowitz, K., & Mellnik, T. (2020, December 28). 2020 turnout is the highest in over a century. The Washington Post. https://www.washingtonpost.com/graphics/2020/elections/voter-turnout/ ↵
- Uggen, C., Larson, R., & Shannon, S. (2016, October 16). 6 million lost voters: State-level estimates of felony disenfranchisement, 2016. The Sentencing Project. https://www.sentencingproject.org/publications/6-million-lost-voters-state-level-estimates-felony-disenfranchisement-2016/ ↵
- Maxouris, C. (2020, October 15). More than 5 million people with felony convictions can’t vote in this year’s election, advocacy group finds. CNN. https://www.cnn.com/2020/10/15/us/felony-convictions-voting-sentencing-project-study/index.html ↵
- Why voting matters: Supreme Court edition. (2018, June 28). Axios. Retrieved from https://www.axios.com/hillary-clinton-2016-election-votes-supreme-court-liberal-justice-1b4bc4fc-9fad-44b4-ab54-9ef86aa9c1f1.html ↵
- Exit polls. (2020). CNN Politics. Retrieved from https://www.cnn.com/election/2020/exit-polls/president/national-results ↵