SECTION 1
Historical Context & Motivation
Long before spreadsheets and software existed, statisticians needed ways to show how different groups compared across categories. A simple bar chart can show how many people prefer dogs versus cats, but what if you also want to see how that preference breaks down by age group or by region? That is the kind of question that led to the development of segmented bar charts, also called stacked bar charts. These charts layer segments inside a single bar so you can compare proportions across groups at a glance.
1786 • William Playfair Invents the Bar Chart
1858 • Florence Nightingale's Polar Area Diagrams
1900s • Stacked Charts Enter Textbooks
2000s • Digital Data Visualization
The central question that segmented bar charts address is: Is there an association between two categorical variables? When you look at a regular bar chart, you see counts or values for one variable. A segmented bar chart adds a second dimension, letting you compare the internal composition of each bar. This makes it much easier to spot patterns, trends, and differences across groups.
SECTION 2
Core Principles & Definitions
Before building a segmented bar chart, you need to understand a few foundational ideas. A categorical variable is a variable that places data into groups or categories rather than measuring a numerical quantity. Examples include favorite color, grade level, or type of transportation. When you have two categorical variables and want to explore how they relate, you organize the data in a two-way frequency table and then translate it into a segmented bar chart.
Categorical Variable
Two-Way Frequency Table
Segmented Bar Chart
100% Stacked Bar Chart
Association
KEY TAKEAWAY
SECTION 3
Visual Explanation
The diagram below shows a 100% segmented bar chart based on a survey of 200 high-school students. Students were asked about their preferred after-school activity, and the results are broken down by grade level (9th, 10th, 11th, and 12th). Each bar reaches the same height — 100% — so you can directly compare the proportions of each activity across grades.
When you interpret a segmented bar chart, start by comparing the same colored segment across all bars. If one segment consistently changes in size from one bar to the next, that pattern signals an association between the two variables. In the chart above, younger students lean toward Sports while older students shift toward Music. If every bar looked nearly identical, you would conclude that grade level and activity preference are not associated.
SECTION 4
Mathematical Framework
The mathematics behind a segmented bar chart is straightforward: you convert raw frequency counts into relative frequencies (percentages) within each group. Here are the key formulas you will use.
RELATIVE FREQUENCY (WITHIN A GROUP)
Category Count = the number of observations in a specific category within a group. Group Total = the total number of observations in that group. This converts raw counts to percentages that sum to 100% for each bar.
JOINT RELATIVE FREQUENCY
Cell Count = the number of observations in one specific combination of both variables. Grand Total = the total number of all observations. This tells you what percentage of the entire data set falls in that cell.
CONDITIONAL RELATIVE FREQUENCY
This is the formula you actually use to compute segment heights in a 100% segmented bar chart. You divide by the row total (or column total) depending on which variable defines your bars.
Why 100% Stacking Matters
SECTION 5
Step-by-Step: From Data Table to Chart
Let's walk through the full process of creating a segmented bar chart using a real-style data set. Suppose a school surveys 200 students about their preferred mode of transportation to school (Car, Bus, Walk), broken down by whether they live in an Urban or Suburban area.
| Car | Bus | Walk | Total | |
|---|---|---|---|---|
| Urban | 20 | 40 | 40 | 100 |
| Suburban | 50 | 30 | 20 | 100 |
| Total | 70 | 70 | 60 | 200 |
Two-Way Frequency Table: Transportation Mode by Area Type
Notice how the Urban and Suburban bars have clearly different compositions. Urban students are much more likely to walk or ride the bus, while Suburban students rely more heavily on cars. Because the segment proportions change from one bar to the next, we say there is an association between area type and transportation mode. If both bars looked identical — say 35% Car, 35% Bus, 30% Walk for both groups — we would say there is no association.
SECTION 6
Worked Example
A teacher surveyed 150 students about whether they prefer reading fiction or nonfiction. The results were grouped by gender identity (Male, Female, Non-binary). Use the data to create a 100% segmented bar chart and determine whether there is an association between gender identity and book preference.
| Fiction | Nonfiction | Total | |
|---|---|---|---|
| Male | 20 | 30 | 50 |
| Female | 45 | 25 | 70 |
| Non-binary | 15 | 15 | 30 |
Two-Way Table: Book Preference by Gender Identity
Constructing and Interpreting a 100% Segmented Bar Chart
- 1
Step 1 — Compute Conditional Relative Frequencies
Divide each cell by its row total and multiply by 100. For Male: Fiction = 20 ÷ 50 × 100 = 40%, Nonfiction = 30 ÷ 50 × 100 = 60%. For Female: Fiction = 45 ÷ 70 × 100 ≈ 64.3%, Nonfiction = 25 ÷ 70 × 100 ≈ 35.7%. For Non-binary: Fiction = 15 ÷ 30 × 100 = 50%, Nonfiction = 15 ÷ 30 × 100 = 50%.Male: 40% Fiction / 60% Nonfiction | Female: 64.3% Fiction / 35.7% Nonfiction | Non-binary: 50% / 50% - 2
Step 2 — Draw the Bars
Create three bars of equal total height (each representing 100%). Label them Male, Female, and Non-binary on the horizontal axis. Shade the Fiction portion in one color (e.g., violet) and the Nonfiction portion in another (e.g., amber). The height of each colored section corresponds to the percentages you just calculated. - 3
Step 3 — Add Labels and a Legend
Write the percentage value inside each segment (or next to it if the segment is narrow). Include a legend identifying which color represents Fiction and which represents Nonfiction. Add axis labels for the group variable (gender identity) and the percentage scale. - 4
Step 4 — Interpret the Chart
Compare the Fiction segments across the three bars. Males show 40% Fiction, Non-binary shows 50%, and Females show about 64%. Because the proportions vary noticeably from one group to another, there appears to be an association between gender identity and book preference in this sample. Females are more likely to prefer fiction, while males lean toward nonfiction. If all three bars had the same proportions, we would conclude there is no association.There IS an association — the distribution of book preference changes across gender identity groups.
SECTION 7
Strengths, Limitations & Comparisons
Segmented bar charts are powerful, but they are not always the best choice. Understanding when to use them — and when another chart type might be clearer — will make you a stronger data communicator.
| Feature | Strength | Limitation |
|---|---|---|
| Comparing proportions | 100% stacked bars make proportional comparisons across groups very intuitive, even with unequal group sizes. | Individual segment sizes can be hard to judge visually when many categories are stacked. |
| Number of categories | Works well with 2–4 categories in the stacked variable. | With 5+ segments, the middle segments float and become difficult to compare precisely. |
| Showing totals | Count-based stacked bars show overall group totals via bar height. | 100% stacked bars hide actual counts — you lose information about group size. |
| Alternative: Side-by-side bars | Segmented bars use less horizontal space than grouped bars. | Side-by-side bars let you compare individual category heights more accurately. |
When to Use (and Not Use) Segmented Bar Charts
CHOOSING THE RIGHT CHART
SECTION 8
Connection to Advanced Methods
Segmented bar charts are your visual entry point into a larger statistical question: Are two categorical variables independent or associated? In more advanced statistics courses, you will formalize this question using hypothesis tests. The table below shows how segmented bar charts connect to what comes next.
| Concept | What You Learn Now | What Comes Later |
|---|---|---|
| Detecting association | Visually compare segment proportions across bars in a segmented bar chart. | The chi-square (χ²) test of independence gives a numerical p-value to determine if the visual difference is statistically significant. |
| Conditional distributions | Compute conditional relative frequencies by hand and plot them as segments. | In AP Statistics, you compare observed vs. expected frequencies under the assumption of independence. |
| Mosaic plots | Each bar has the same width (100% stacking focuses on proportions only). | Mosaic plots vary bar widths to also represent group sizes, giving a richer picture of the data. |
From Visual Exploration to Formal Inference
Think of a segmented bar chart as the exploratory step: you look at the data and form a hypothesis about association. The chi-square test is the confirmatory step: it tells you whether the pattern you see could easily have occurred by random chance. Building strong chart-reading skills now will make those later techniques much more intuitive.
SECTION 9
Practice Problems
Question 1: CONCEPTUAL
Show answer
Question 2: BASIC CALCULATION
Show answer
Question 3: INTERMEDIATE
Show answer
Question 4: APPLIED
Show answer
Question 5: CRITICAL THINKING
Show answer
SUMMARY
Lesson Summary
Summary
A segmented bar chart divides each bar into colored segments that represent categories of a second categorical variable. To enable fair comparisons across groups of different sizes, you convert raw counts into conditional relative frequencies and build a 100% stacked bar chart where every bar reaches the same total height.
You detect an association between two categorical variables when the segment proportions differ noticeably from one bar to the next. If all bars have roughly the same composition, the variables appear not associated. This visual approach lays the groundwork for more advanced techniques like the chi-square test of independence, which you will encounter in future statistics courses.