01 / 21

Representing a
Categorical Variable with Graphs

Learn to display categorical data using bar charts, pie charts, and more: choosing the right graph, reading distributions, and avoiding common pitfalls.

AP Statistics

What Is a Categorical Variable?

A categorical variable places individuals into one of several groups or categories. Unlike quantitative variables (which measure amounts), categorical variables label or classify.

Categorical
Favorite color, political party, blood type, zip code
Quantitative
Height, GPA, temperature, number of siblings

Why Graph Categorical Data?

A frequency table gives exact counts, but a graph lets you instantly compare category sizes, spot the mode, and communicate findings to an audience.

1
Compare at a glance: bar heights or slice sizes reveal which categories dominate.
2
Reveal patterns: unexpected small or large categories become obvious visually.
3
Communicate clearly: graphs are the universal language of data analysis on the AP exam.

Frequency vs. Relative Frequency

Before graphing, you need to summarize the data. Two key summaries for categorical variables:

Frequency
The count of individuals in each category.
Relative Frequency
The proportion (or percentage) of individuals in each category: \(\frac{\text{count}}{\text{total}}\).

The Bar Chart

A bar chart displays each category as a separate bar. The height (or length) of each bar represents the frequency or relative frequency of that category.

0 10 20 30 40 Rock Pop Jazz Hip-Hop 35 25 15 20 Frequency Music Genre

Bar Chart Requirements

1
Label both axes: the categorical variable on one axis, frequency or relative frequency on the other.
2
Scale must start at zero: a truncated axis distorts the visual comparison of bar heights.
3
Equal bar widths: only the height (or length) should encode quantity.
4
Include gaps: spaces between bars indicate separate, unordered categories.
5
Title the graph: a clear title communicates the variable and context.

The Pie Chart

A pie chart displays each category as a slice of a circle. The angle (and area) of each slice is proportional to that category's relative frequency.

Rock 36.8% Pop 26.3% Hip-Hop 21.1% Jazz 15.8%

Bar Chart vs. Pie Chart

Feature Bar Chart Pie Chart
Best for Comparing sizes of categories Showing parts of a whole
Number of categories Any number Few (3 to 6)
Can show frequency? Yes No: only relative frequency
Easy to compare? Very easy Harder for similar-sized slices
AP exam preference Preferred Acceptable but less common

Segmented Bar Charts

When you have two categorical variables, a segmented (stacked) bar chart displays the conditional distribution of one variable within each category of the other.

0% 25% 50% 75% 100% Male Female Rock Pop Jazz Hip-Hop

Side-by-Side Bar Charts

An alternative for two categorical variables is the side-by-side bar chart: bars for each group are placed next to each other within each category, making direct comparison easier.

0 10 20 30 40 Rock Pop Jazz Hip-Hop Male Female

How to Choose the Right Graph

1
Identify the variable(s): Is it one categorical variable, or two?
2
Determine your goal: compare counts (bar chart), show parts of a whole (pie chart), or compare conditional distributions (segmented or side-by-side)?
3
Count the categories: pie charts work for 3 to 6 categories; bar charts handle any number.
4
Check the data: if you only have percentages, you cannot use a frequency bar chart.
5
Label everything: title, axis labels, and a legend (if needed) are required for full credit on the AP exam.

Example 1: Building a Bar Chart

A survey asked 200 students about their favorite subject. Results: Math: 60, English: 50, Science: 45, History: 30, Art: 15.

0 15 30 45 60 Math English Science History Art 60 50 45 30 15 Number of Students Favorite Subject

Example 2: Relative Frequency Chart

Using the same data (\(n = 200\)), convert to relative frequencies and create a relative frequency bar chart.

Subject Frequency Relative Frequency
Math600.30 (30%)
English500.25 (25%)
Science450.225 (22.5%)
History300.15 (15%)
Art150.075 (7.5%)

Example 3: Comparing Two Groups

A researcher records transportation mode for 9th graders (\(n = 120\)) and 12th graders (\(n = 100\)). Which graph best compares conditional distributions?

9th Graders
Bus: 50%, Car: 25%, Walk: 15%, Bike: 10%
12th Graders
Bus: 20%, Car: 55%, Walk: 10%, Bike: 15%

Describing a Categorical Distribution

When you describe a graph of categorical data on the AP exam, include these elements:

1
Name the most/least common categories: identify the mode and any notably small categories.
2
Give counts or percentages: use specific numbers, not just "bigger" or "smaller."
3
Compare when asked: if two distributions are shown, describe similarities and differences.
4
Use context: always refer to the actual variable name and categories, not generic labels.

Common Mistakes to Avoid

✕ Using a Histogram
Histograms are for quantitative data (no gaps). Bar charts have gaps for categorical data.
✕ Unequal Bar Widths
Varying widths mislead the viewer: only height should encode quantity.
✕ Truncated Axis
Not starting the frequency axis at zero exaggerates differences between bars.
✕ Pie with Too Many Slices
More than 6 or 7 slices makes it nearly impossible to compare areas accurately.
✕ Comparing Counts Across Unequal Groups
Use relative frequency when group sizes differ, not raw counts.
✕ Missing Labels
No title, no axis labels, or no legend means lost points on the AP exam.

Question 1 of 5

Which type of graph is most appropriate for displaying the distribution of a single categorical variable?

Question 2 of 5

In a bar chart, the bars should have gaps between them because:

Question 3 of 5

A survey of 400 adults finds that 160 prefer coffee, 120 prefer tea, 80 prefer juice, and 40 prefer water. What is the relative frequency for tea?

Question 4 of 5

When comparing the distribution of a categorical variable across two groups of different sizes, you should use:

Question 5 of 5

A pie chart is least appropriate when: