Find a course

Module 2: Displaying DataLesson 3 of 912 min

Bar Charts, Pie Charts and Two-Way Tables

Summarize categorical data with frequency tables, bar and pie charts, and read joint, marginal and conditional percents in two-way tables.

Step 1 of 13Learn

From a pile of answers to a table

The student council asks 200 students: What do you mostly do after school? The raw answers are a jumble of 200 words: sports, job, homework, sports, gaming, club, homework... Nobody can see a pattern in that.

The first step is a frequency table: list each category and count how many answers fall in it.

ActivityFrequencyRelative frequency
Sports4623%
Homework5829%
Gaming4020%
Clubs2412%
Job3216%
Total200100%

The relative frequency is each count divided by the total: 46 ÷ 200 = 0.23 = 23%. Relative frequencies are what let you compare groups of different sizes, like your school's 200 answers with another school's 650.

Check your table: frequencies must add up to the number of individuals, and relative frequencies to 100% (or very close, if you rounded).

Step 2 of 13Practice · Chart

What 200 students mostly do after school

Tap the activity with a relative frequency of 16%.

Tap the bar that answers the question, then press Check.

What 200 students mostly do after schoolBar chart with 5 categories: Sports: 46; Homework: 58; Gaming: 40; Clubs: 24; Job: 32.0204060FrequencySportsHomeworkGamingClubsJob4658402432
The frequency table above, drawn as a bar chart.
What 200 students mostly do after school
ItemStudents
Sports46
Homework58
Gaming40
Clubs24
Job32

Step 3 of 13Practice · Work it out

In a survey of 250 students, 35 said their favorite subject is science. What is the relative frequency of science, as a percent?

Step 4 of 13Learn

Bar charts vs. pie charts

Once you have a frequency table, you can graph it.

A bar chart draws one bar per category, with heights showing counts or percents. Bars are separated by gaps because the categories are distinct, and their order doesn't matter, so sorting from tallest to shortest often makes the chart easiest to read. Bar charts are the best all-purpose choice for categorical data and make it easy to compare categories precisely.

A pie chart shows each category as a slice of a circle, with the slice angle proportional to its share. A category with 25% of the data gets a quarter of the circle, 90°. Pie charts emphasize parts of a whole, but they only work when:

  • the categories don't overlap (each individual is in exactly one), and
  • the slices add up to 100% of a meaningful whole.

If a survey lets people pick several answers, the percents can add up to more than 100%, and a pie chart becomes nonsense. Use a bar chart instead. Pie charts also make it hard to compare slices of similar size, so many statisticians prefer bars even when a pie is allowed.

Step 5 of 13Practice · Choose one

A survey asked students to select all the social media apps they use. The results add up to 230%. Which graph should you use?

Step 6 of 13Practice · Chart

The same table as a pie

A pie works here because each student gave exactly one answer, so the parts add up to 100%.

Tap the slice that is about one-eighth of the circle.

Tap the slice that answers the question, then press Check.

The same table as a pieDonut chart with 5 categories: Sports: 23% (23%); Homework: 29% (29%); Gaming: 20% (20%); Clubs: 12% (12%); Job: 16% (16%).23%29%20%12%16%100%Total
The same table as a pie
ItemShare of students
Sports23%
Homework29%
Gaming20%
Clubs12%
Job16%

Step 7 of 13Learn

Two-way tables

Sometimes you record two categorical variables for each person. A school surveys 9th and 12th graders about whether they have a part-time job:

Has a jobNo jobTotal
9th grade12108120
12th grade454590
Total57153210

This is a two-way table. The numbers inside are joint frequencies (12 ninth graders have a job). The totals in the margins are marginal frequencies (57 students in all have a job).

The most useful numbers are conditional relative frequencies: percents within one row or column.

  • Of 9th graders, 12 ÷ 120 = 10% have a job.
  • Of 12th graders, 45 ÷ 90 = 50% have a job.

Because the percents differ a lot between grades, we say grade level and having a job are associated. If both grades had about the same percent, there would be no association. Comparing raw counts (12 vs. 45) would mislead, since the groups are different sizes; that's why conditional percents matter.

Step 8 of 13Practice · Work it out

Using the job table, what percent of the students who have a job are 12th graders? Round to one decimal place.

Step 9 of 13Practice · Chart

Job or no job, by grade (percent of each grade)

Each bar is one grade, scaled to 100%. These are conditional percents: we divided by each grade's own total.

Tap the grade where half the students have a job.

Tap the bar that answers the question, then press Check.

Job or no job, by grade (percent of each grade)Stacked bar chart with 2 categories: 9th grade: Has a job 10%, No job 90%; 12th grade: Has a job 50%, No job 50%.0%20%40%60%80%100%9th grade12th grade100%100%
Job or no job, by grade (percent of each grade)
ItemHas a jobNo job
9th grade10%90%
12th grade50%50%

Step 10 of 13Note

Step 11 of 13Practice · Fill in the blanks

Fill in the blanks

In the job table, the marginal total of students with no job is , and the joint frequency of 12th graders with no job is .

Step 12 of 13Practice · True or false

In a two-way table, if the conditional percents are very different for two groups, the two variables are associated.

Step 13 of 13Practice · Choose one

You want to compare the favorite music genres of 9th graders and 12th graders, and the grades have different numbers of students. Which display is best?