How to make bar graphs and pie charts from a frequency table

A frequency table gives us the counts for each category, but a graph can make the pattern easier to see. Bar graphs compare those counts directly, while pie charts show each category as part of the whole. Let’s build both displays from the same historical data.

Organize the data in a frequency table

Each observation in this example is an edition of the Olympic Games, and the categorical variable is the continent of its host city. Count the observations in each category to build a frequency table. The Summer Games data below covers 1896 through 2016, excludes canceled Games, and contains 28 editions.

Historical Summer Games host counts, 1896–2016
ContinentCount
Europe16
North America6
Asia3
Australia2
South America1
Total28

Europe appears 16 times in this fixed data set, so its frequency is 16. The count is a numerical summary of the host-continent category.

Draw a bar graph with a common scale

Put the categories on one axis and counts on the other. Start the count scale at zero, keep bar widths consistent, and leave space between categories. The length or height of each bar represents its count.

Historical Olympic host counts by continentSummer Games, 1896–2016: 28 editions, excluding canceled Games.Host continentEurope16North America6Asia3Australia2South America105101520Number of Games
Summer Games, 1896–2016: 28 editions, excluding canceled Games.

The horizontal graph leaves room for the category names. A vertical graph would show the same counts with bar heights. Sorting by count is useful for comparison when the categories have no required order.

Europe has the largest count, followed by North America. The exact labels and frequency table give the counts; the bars make their differences easy to compare.

Convert each count to a pie-chart slice

A pie chart divides one total into nonoverlapping categories. Divide each count by the total to get its share, then multiply by 360 degrees to find its slice angle.

Share=Category countTotal countSlice angle=360°×Share

For Europe in the Summer Games data, the count is 16 out of 28.

1628=47≈0.57141628×100%≈57.1%1628×360°≈205.7°

Repeat this calculation for every category. The shares add to 1, and the unrounded slice angles add to 360 degrees.

Summer Olympic host-continent proportionsSummer host-continent shares in the fixed historical data set. Counts in the legend add to 28.Summer GamesEurope: 16North America: 6Asia: 3Australia: 2South America: 1
Summer host-continent shares in the fixed historical data set. Counts in the legend add to 28.

Example: Make charts for the historical Winter Games

The Winter Games data in this example covers 1924 through 2018, excludes canceled Games, and contains 23 editions. The host-city records give the following frequency table.

Historical Winter Games host counts, 1924–2018
ContinentCount
Europe14
North America6
Asia3
Total23

A bar graph for these data would have three bars of lengths 14, 6, and 3. For the pie chart, divide each count by 23. Europe’s slice, for example, has angle

1423×360°≈219.1°
Winter Olympic host-continent proportionsWinter host-continent shares in the fixed historical data set. Counts in the legend add to 23.Winter GamesEurope: 14North America: 6Asia: 3
Winter host-continent shares in the fixed historical data set. Counts in the legend add to 23.

Compare the two data sets with grouped bars

Grouped bars place the Summer and Winter counts next to one another for each continent. Use the same count scale for both series so that bar lengths have the same meaning.

Historical Olympic host counts by continentSummer Games, 1896–2016, and Winter Games, 1924–2018. The two series use the same count scale.Host continentEuropeNorth AmericaAsiaAustraliaSouth America05101520Number of GamesSummerWinter
Summer Games, 1896–2016, and Winter Games, 1924–2018. The two series use the same count scale.

In these historical data sets, Europe has more Summer than Winter editions, and North America has six of each. The Summer and Winter totals differ, so a count comparison answers a different question from comparing their pie-chart shares. A bar graph is useful for comparing categories; a pie chart emphasizes how each category contributes to one whole.