Students use data displays like bar and pie charts to create 1 and 2level groupings to visualize the distribution of categorical data.
Lesson Goals 
Students will be able to:

Studentfacing Lesson Goals 

Materials 

Supplemental Materials 

Key Points for the Facilitator 
This lesson uses the Expanded Animals Starter File, which includes far more animals than the smaller sample represented in the animals starter file used in most of our lessons. 
🔗Grouping by Value 25 minutes
Overview
Students learn one way of grouping data, showing the frequency of values in a dataset using bar and pie charts.
Launch

Open the Expanded Animals Starter File and click "Run".

Then complete Part A of Count, Bar Charts and Pie Charts, by testing the expressions
count(moreanimals, "species")
andbarchart(moreanimals, "species")
in the Interactions Area.

How do the count table and bar chart you just made compare?

The height of each bar matches the count of each species.


How does this pie chart compare to the bar chart you just made?

The wedges show percentages, whereas the bar chart was labeled with the count. We could figure out how many animals were in the sample from the bar chart. With the pie chart we see how the categories compare to each other, but we have no way of knowing how many animals each wedge represents.

Investigate
Have students complete Bar Chart  Notice and Wonder and Pie Chart  Notice and Wonder.
Turn to Bar & Pie Chart  Notice and Wonder and take two minutes to notice and wonder about the displays. Then compare your Notices and Wonders with your partner.
Both barchart
and count
group the data in one column by value, creating "buckets" for each unique value and counting the number of rows in each bucket, one uses a picture and one uses a table.
When you first build a bar chart or pie chart in pyret, they are interactive displays. That means that you can mouse over a bar to reveal the label, as well as the number of animals in that species. We can also resize the window by dragging its borders. This allows us to experiment with the data before closing the window and generating the final, noninteractive image.
Bar charts group data by value to show frequency as a count.
Pie charts show us the percentage of the data points that fall in each category. Hovering over a pie slice reveals the label, as well as the count and the percentage of the whole. In this example we see that there is 1 animal that is a snail, representing 3.1% of the population.
Pie charts group data by value to show frequency as a percentage.
If our data is based on sample data from a larger population, we can use these charts to infer the proportion of a whole population that might belong to each category. For example, the distribution of species in our shelter might help us make guesses about the distribution of species in other shelters.
While bars in some bar charts should follow some logical order (alphabetical, smallmediumlarge, etc), the pie slices and bars can really be placed in any order, without changing the meaning of the chart.

Complete Matching Bar and Pie Charts with your partner.

Then return to Count, Bar Charts and Pie Charts and complete parts B & C.

What information is provided in bar charts that is hidden in pie charts?

Categories containing 0% of the data aren’t represented on a pie chart.


Why might it sometimes be problematic to use a pie chart, thereby hiding a category?

If, for example, a sector of the population is unrepresented in positions of power, it’s easier to ignore the issue if that population doesn’t get represented in the display.


Why isn’t it useful to group the
pounds
column usingbarchart
orpiechart
?
Grouping by value works well for categorical data, when lots of different data points can be sorted into a smaller number of buckets. But for quantitative data  which can have lots of different values  the number of buckets is too large to be useful.

Grouping by value works well when lots of different data points can be sorted into a smaller number of buckets.
Common Misconceptions

Bar charts look a lot like another kind of chart  called a "histogram"  which are actually quite different because they display quantitative data, not categorical. This lesson focuses entirely on pie and bar charts.

When comparing bar charts, it is important to read the scales on the yaxes. If the scales do not match, a taller bar may not represent a larger value.

The percentages on pie charts will always add to 100%, so if there are 5 subgroups of a population and we’re only going to look at data from 2 of the subgroups, it wouldn’t make sense to use a pie chart to compare them!

Relatedly, pie charts only have a wedge for each category whose population is large enough to claim a percentage of the pie. Unlike in bar charts, empty categories will not be included in a pie chart.
Synthesize

How is
piechart
similar tobarchart
? How is it different? 
When would you want to use one chart instead of another?

Which displays do you find it easier to interpret? Why?

What questions about the dataset are you curious to investigate using these displays?
Optional Extension
Sometimes we want to visualize data that is already summarized:
Hair Color  Number of Students 

"Black" 
5 
"Brown" 
13 
"Blond" 
4 
"Red" 
2 
"Pink" 
1 
In this situation, we want to use the values in the first column for the labels of our pie slices or bars, and the values in the second column for the size. We have contracts for those, too:
# piechartsummarized :: (Tabletablename, Stringlabels, Stringvalues) > Image
# barchartsummarized :: (Tabletablename, Stringlabels, Stringvalues) > Image
Open the Hair Color Starter File to try them out!
🔗Groups and Subgroups 20 minutes
Overview
Students learn how to create groups within groups, showing the relative frequency of one variable across values of another variable using stacked and multi bar charts.
Launch
Turn to Introducing Displays for Subgroups and complete Part A now.
Comparing groups is great, but sometimes we want to compare subgroups across groups. In this example, we want to compare the distribution of sexes across each species.

Let’s step away from the Animals Dataset for a moment to learn about some new kinds of displays that would make it easier to answer questions like these by revealing the subgroups in a column. Turn to Multi Bar & Stacked Bar Charts  Notice and Wonder.

What do you Notice? What do you Wonder?
Investigate
Pyret has two functions that let us specify both a group and a subgroup:
# stackedbarchart :: (Tabletablename, Stringgroup, Stringsubgroup) > Image
# multibarchart :: (Tabletablename, Stringgroup, Stringsubgroup) > Image
Complete Part B of Introducing Displays for Subgroups
Stacked Bar Chart 
Multi Bar Chart 


Stacked Bar Charts put the groups side by side, so it’s easy to answer which species is the "most female". But it’s more difficult to see whether there are more female dogs than male cats, because the bars don’t all start from the bottom and they’re in percentages rather than raw quantities. 
Multi Bar Charts put the subgroups side by side, so it’s easy to answer whether there are more female dogs than male cats in the shelter. But it’s a little more difficult to see which species is the "most female", because we have to estimate the relative lengths of each bar. 
Synthesize
All of the charts we’ve looked at in this lesson work with categorical data, showing us the frequency of values in one or two groups.

What are some of the questions you asked about the animals dataset using these displays? And what did you learn?

What kinds of questions need stacked or multi bar charts, rather than pie or bar charts

What kinds of questions are better answered by stacked bar charts?

What kinds of questions are better answered by multi bar charts?
Optional Project: Making Infographics
Infographics are a powerful tool for communicating information, especially when made by people who actually understand how to connect visuals to data in meaningful ways. Project: Make an Infographic is an opportunity for students to become more flexible math thinkers while tapping into their creativity. This project can be made on the computer or with pencil and paper.
🔗Additional Exercises

For more practice making and interpreting these chart types in Pyret, we have a second teaching dataset for you to work with! You can have students create additional displays using Global Food Supply & Production Starter File.

For more practice without a computer, have students turn to Matching Stacked and Multi Bar Charts.
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.