Skip to content

Unit 1: Exploring One-Variable Data and Collecting Data

Graphical Representations for One Categorical Variable

Draw bar charts and pie charts for a categorical variable, use them to justify claims in context, and compare groups of different sizes without being misled.

Topic 1.4 · 8 min read

A ski resort's clinic recorded the type of injury for each of the 250 skiers it treated last season: 100 knee injuries, 25 wrist, 35 head, 40 shoulder and 50 other. Topic 1.3 put counts like these in a table. A graph shows the same information at a glance, so that the biggest category, and how much bigger it is, jump out before anyone reads a number. Two graphs do this for a categorical variable: the bar chart and the pie chart.

Bar charts

A bar chart (or bar graph) has one bar for each category. The bar's height (or its length, if the bars run sideways) is the category's frequency or relative frequency.

Bar chart of injuries to 250 skiers. Horizontal axis: type of injury. Vertical axis: number of skiers, 0 to 100. Bar heights: Knee 100, Wrist 25, Head 35, Shoulder 40, Other 50.

To build one:

  1. Put the categories along one axis and label it with the variable's name.
  2. Put a numerical scale on the other axis, starting at 0, labeled "Frequency" (or what was counted) or "Relative frequency."
  3. Draw one bar per category, all the same width, with equal gaps between them, each reaching its category's value.

The gaps matter. They show that the categories are separate groups, not intervals on a number line, which is what a histogram's touching bars mean (topic 1.5). The order of the bars is a choice: for categories with no natural order, sorting from tallest to shortest makes comparisons easy; for ordered categories (Never, Sometimes, Often), keep their order.

A frequency bar chart and a relative frequency bar chart of the same data have exactly the same shape. Dividing every count by 250 rescales the axis and leaves every bar's height relative to the others unchanged. The difference only matters when two groups are compared, below.

Pie charts

A pie chart shows a whole divided into parts. Each category gets a slice, and the slice's share of the circle equals the category's relative frequency. Since the angles around the center add to 360°360°, a category with relative frequency rr gets a slice with angle r×360°r \times 360°. The knee slice is 0.40×360°=144°0.40 \times 360° = 144°; the wrist slice is 0.10×360°=36°0.10 \times 360° = 36°.

Pie chart of injuries to 250 skiers, with slices labeled Knee 40%, Wrist 10%, Head 14%, Shoulder 16%, Other 20%. The Knee slice is the largest, a little less than half the circle.

Because the slices fill the circle, they add to 1 (100%) of it, and that's the condition for using one: each unit must fall in exactly one category, and the categories must cover everyone. Two situations break it:

  • Units in more than one category. A survey asking "Which streaming services do you use? Check all that apply" lets one person count for several services, so the percentages add to more than 100%. There is no whole for the slices to divide. Use a bar chart, with each bar showing the percentage of respondents who use that service.
  • A missing category. If a report gives percentages for Knee, Wrist and Head only (64% together), a pie with only those three slices would make each look bigger than it is. Add the remaining category ("Other," 36%) or use a bar chart.

Pie charts are good at one comparison: a part against the whole ("knee injuries were 40% of the total, a bit less than half"). Bar charts are better for comparing categories with each other, because the eye judges heights from a common baseline more accurately than angles. In the pie above, the Head (14%) and Shoulder (16%) slices are hard to rank by eye; in the bar chart it's obvious.

Using a graph to back a claim

A claim about a categorical variable is supported by a graph when you can read off the specific values that make it true and say them in context. "Knee injuries were the most common type among the clinic's injured skiers: 100 of 250, or 40%" uses the graph. "The knee bar is biggest" describes the picture without saying what it means.

Read the scale before you read the bars. Here is the proportion of skiers with knee injuries next to the proportion of snowboarders with knee injuries (0.16, from the clinic's 150 injured snowboarders), with a vertical axis that starts at 0.15 instead of 0:

Bar chart comparing the proportion of injured skiers (0.40) and injured snowboarders (0.16) with knee injuries. The vertical axis starts at 0.15, not 0, so the snowboarder bar is a sliver and the skier bar looks about 25 times as tall.

The skier bar looks about 25 times as tall as the snowboarder bar, because the visible parts are 0.40−0.15=0.250.40 - 0.15 = 0.25 and 0.16−0.15=0.010.16 - 0.15 = 0.01. The real ratio is 0.400.16=2.5\frac{0.40}{0.16} = 2.5. Bar heights only compare honestly when bars start at 0. When an axis doesn't, base your claim on the values, not the look.

Comparing groups

To compare two or more groups on the same categorical variable, graph each group's relative frequencies. The clinic also treated 150 snowboarders: 24 knee, 54 wrist, 21 head, 27 shoulder and 24 other injuries. Frequency bars would put 250 skiers against 150 snowboarders, and almost every skier bar would be taller just because there were more skiers. Dividing by each group's own total puts both on the same scale, and a side-by-side bar chart shows each category's bars next to each other:

Side-by-side bar chart of relative frequencies of injury type for 250 skiers and 150 snowboarders. Knee: skiers 0.40, snowboarders 0.16. Wrist: skiers 0.10, snowboarders 0.36. Head: both 0.14. Shoulder: skiers 0.16, snowboarders 0.18. Other: skiers 0.20, snowboarders 0.16.

Two pie charts, one per group, also compare groups, since each pie is already in proportions. They make "what share of each group" easy to see but category-by-category differences harder; the side-by-side bar chart lines those up.

Worked examples

Worked exampleExample 1: building both graphs

Of the 80 student-athletes at a high school, 28 play a fall sport as their main sport, 20 a winter sport and 32 a spring sport. Describe the bar chart of relative frequencies, and find the angle of each slice of a pie chart.

Show solution

Relative frequencies: fall 2880=0.35\frac{28}{80} = 0.35, winter 2080=0.25\frac{20}{80} = 0.25, spring 3280=0.40\frac{32}{80} = 0.40. They add to 1, and each athlete has exactly one main sport, so a pie chart is appropriate.

Bar chart: seasons (Fall, Winter, Spring, in their natural order) on the horizontal axis; "Relative frequency" from 0 to about 0.45 on the vertical axis; three separated bars of heights 0.35, 0.25 and 0.40.

Pie angles: fall 0.35×360°=126°0.35 \times 360° = 126°, winter 0.25×360°=90°0.25 \times 360° = 90° (a quarter of the circle), spring 0.40×360°=144°0.40 \times 360° = 144°. Check: 126°+90°+144°=360°126° + 90° + 144° = 360°.

Worked exampleExample 2: when a pie chart doesn't fit

A survey asked 200 teenagers which social media apps they use at least weekly and let them choose as many as applied. The results: 152 chose App A, 118 App B, 96 App C and 40 App D. A student plans to show the results in a pie chart. Explain why that is not appropriate, and name a graph that is.

Show solution

The counts add to 152+118+96+40=406152 + 118 + 96 + 40 = 406, more than the 200 teenagers surveyed, because many teens use more than one app. A pie chart's slices must divide one whole, with each unit in exactly one slice; here the percentages (76%76\%, 59%59\%, 48%48\%, 20%20\%) add to 203%203\%, so there's no whole for them to divide.

A bar chart works: one bar per app, with height equal to the percentage of the 200 teenagers who use it weekly. Each bar stands on its own, so overlap between apps doesn't matter.

Worked exampleExample 3: exam-style free response

The side-by-side bar chart above shows the relative frequencies of injury types for the 250 skiers and 150 snowboarders treated at the resort's clinic last season.

(a) A clinic nurse says, "More skiers than snowboarders hurt their heads, so skiers are more likely to have head injuries." Do the data support this claim? Justify your answer.

(b) Compare the distributions of injury type for skiers and snowboarders.

(c) Explain why the side-by-side bar chart uses relative frequencies instead of frequencies.

Show solution

(a) No. More skiers than snowboarders had head injuries (0.14×250=350.14 \times 250 = 35 compared with 0.14×150=210.14 \times 150 = 21), but only because the clinic treated more skiers. Head injuries made up the same proportion, 0.14, of injuries in both groups, so the data give no evidence that head injuries are more likely among the injured skiers than among the injured snowboarders.

(b) The most common injury differs between the groups. Knee injuries were the most common for skiers (0.40 of injured skiers) but made up only 0.16 for snowboarders. Wrist injuries were the most common for snowboarders (0.36) and the least common for skiers (0.10). Head injuries (0.14 for both), shoulder injuries (0.16 for skiers, 0.18 for snowboarders) and other injuries (0.20 and 0.16) occurred in similar proportions in the two groups.

(c) The clinic treated 250 skiers and only 150 snowboarders. On a frequency scale, the skier bars would tend to be taller just because the group is larger. Relative frequencies divide each count by its own group's total, so the bars compare the share of each group with each type of injury.

Why these moves: (a) answers yes or no first, then gives the numbers that decide it, and names the reason the counts mislead. (b) points to the categories where the groups differ most, with values from the graph for each group, and says where they're alike. (c) names the group sizes, the concrete fact that makes counts unfair. All three are about these patients at this clinic, which is the context graders look for.

Where students lose points

Check yourself

  1. Question 1

    In a survey of 120 commuters, 45 said they usually take the train. In a pie chart of the survey's results, what is the angle of the train slice?

    1. A

      45°45°

    2. B

      37.5°37.5°

    3. C

      135°135°

    4. D

      162°162°

    Show answer

    C

    The train category's relative frequency is 45120=0.375\frac{45}{120} = 0.375, and the slice gets that fraction of 360°360°: 0.375×360°=135°0.375 \times 360° = 135°. Choice A uses the count as the angle; choice B uses the percentage, 37.5, as the angle.

  2. Question 2

    For which of these data sets is a pie chart appropriate?

    1. A

      The percentage of a town's households that own each of five kinds of pet, where a household can own several kinds

    2. B

      The main language spoken at home by each of 300 students, with categories English, Spanish, Vietnamese, and Other

    3. C

      The percentages of voters in three districts who voted yes on a measure

    4. D

      The number of points a basketball team scored in each of its 20 games

    Show answer

    B

    Each student has exactly one main home language and "Other" covers everyone left, so the slices make one whole. In A a household can be in several categories, so the percentages need not add to 100%; C has three separate groups' yes rates, not parts of one whole; D is a quantitative variable.

  3. Question 3

    Two pie charts show how students in two classes get to school. In Class A, which has 30 students, the Walk slice is 40%. In Class B, which has 50 students, the Walk slice is 30%. Which class has more students who walk, and which has a larger share of walkers?

    Show answer

    Class B has more walkers (0.30×50=150.30 \times 50 = 15, compared with 0.40×30=120.40 \times 30 = 12), but Class A has the larger share of walkers (40% compared with 30%).

    A pie chart shows proportions, so the size of a slice says nothing about counts until you multiply by the group's total. "More" and "a larger share" are different questions, and here they have different answers.

  4. Question 4

    A relative frequency bar chart shows the preferred candidate of 400 surveyed voters. The bar for Candidate Ruiz is at 0.35 and the bar for Candidate Okafor is at 0.28. How many more of the surveyed voters preferred Ruiz than Okafor?

    Show answer

    2828 voters

    Ruiz: 0.35×400=1400.35 \times 400 = 140 voters. Okafor: 0.28×400=1120.28 \times 400 = 112 voters. The difference is 140−112=28140 - 112 = 28, the same as (0.35−0.28)×400(0.35 - 0.28) \times 400. Answering 0.07 gives a difference in proportions, not a number of voters.

Go deeper