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.
| Continent | Count |
|---|---|
| Europe | 16 |
| North America | 6 |
| Asia | 3 |
| Australia | 2 |
| South America | 1 |
| Total | 28 |
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.
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.
For Europe in the Summer Games data, the count is out of .
Repeat this calculation for every category. The shares add to 1, and the unrounded slice angles add to 360 degrees.
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.
| Continent | Count |
|---|---|
| Europe | 14 |
| North America | 6 |
| Asia | 3 |
| Total | 23 |
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
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.
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.