4.9 Presenting Categorical Data Graphically

Learning Outcomes

  • Create a frequency table that represents a data set
  • Analyze a bar graph that represents a data set
  • Create a Pareto chart that represents a data set
  • Analyze a pie chart that represents a data set

Visualizing Data

Categorical, or qualitative, data are pieces of information that allow us to classify the objects under investigation into various categories. We usually begin working with categorical data by summarizing the data into a frequency table.

Frequency Table

A frequency table is a table with two columns. One column lists the categories, and another for the frequencies with which the items in the categories occur (how many items fit into each category).

Example

An insurance company determines vehicle insurance premiums based on known risk factors. If a person is considered a higher risk, their premiums will be higher. One potential factor is the color of your car. The insurance company believes that people with some color cars are more likely to get in accidents. To research this, they examine police reports for recent total-loss collisions. The data is summarized in the frequency table below.

Color Frequency
Blue 25
Green 52
Red 41
White 36
Black 39
Grey 23

Try It

Sometimes we need an even more intuitive way of displaying data. This is where charts and graphs come in.  There are many, many ways of displaying data graphically, but we will concentrate on one very useful type of graph called a bar graph.  In this section we will work with bar graphs that display categorical data; the next section will be devoted to bar graphs that display quantitative data.

Bar graph

A bar graph is a graph that displays a bar for each category with the length of each bar indicating the frequency of that category.

To construct a bar graph, we need to draw a vertical axis and a horizontal axis.  The vertical direction will have a scale and measure the frequency of each category; the horizontal axis has no scale in this instance.  The construction of a bar chart is most easily described by use of an example.

example

Using our car data from above, note the highest frequency is 52, so our vertical axis needs to go from 0 to 52, but we might as well use 0 to 55, so that we can put a hash mark every 5 units:

Bar graph. Vertical measures Frequency, in increments of 5 from 0 to 55. Horizontal measures Vehicle color involved in a total-loss collision, showing from left Blue (25), Green (53), Red (41), White (37), Black (39), Grey (24).

Notice that the height of each bar is determined by the frequency of the corresponding color.  The horizontal gridlines are a nice touch, but not necessary.  In practice, you will find it useful to draw bar graphs using graph paper, so the gridlines will already be in place, or using technology.  Instead of gridlines, we might also list the frequencies at the top of each bar, like this:

Bar graph. Vertical measures Frequency, in increments of 5 from 0 to 55. Horizontal measures Vehicle color involved in a total-loss collision, showing from left Blue (25), Green (52), Red (41), White (36), Black (39), Grey (23).

The following video explains the process and value of moving data from a table to a bar graph.

In this case, our chart might benefit from being reordered from largest to smallest frequency values. This arrangement can make it easier to compare similar values in the chart, even without gridlines. When we arrange the categories in decreasing frequency order like this, it is called a Pareto chart.

Pareto chart

A Pareto chart is a bar graph ordered from highest to lowest frequency

Examples

Transforming our bar graph from earlier into a Pareto chart, we get:

Bar graph. Vertical measures Frequency, in increments of 5 from 0 to 55. Horizontal measures Vehicle color involved in a total-loss collision, showing from left Green (52), Red (41), Black (39), White (36), Blue (25), Grey (23).

The following video addressed Pareto charts.


In a survey[1], adults were asked whether they personally worried about a variety of environmental concerns. The numbers (out of 1012 surveyed) who indicated that they worried “a great deal” about some selected concerns are summarized below.

Environmental Issue Frequency
Pollution of drinking water 597
Contamination of soil and water by toxic waste 526
Air pollution 455
Global warming 354

This data could be shown graphically in a bar graph:

Pareto Bar Graph. Vertical measures Frequency, in units of 100 from 0 - 600. Horizontal measures Environmental Worries. From left, Water Pollution (600), Toxic Waste (~500), Air Pollution (~450), and Global Warming (~350).

 

To show relative sizes, it is common to use a pie chart.

Pie Chart

A pie chart is a circle with wedges cut of varying sizes marked out like slices of pie or pizza.  The relative sizes of the wedges correspond to the relative frequencies of the categories.

Recall percents

In the examples that follow, you’ll need to be able to find percents from proportions and be able to find the percentage of a number.

[latex]\text{a proportion is:} \hspace{.5cm} \dfrac{\text{some part}}{\text{the whole}}[/latex].

[latex]\text{a percent is:} \hspace{1cm} \dfrac{\text{a number}}{100}[/latex].

Ex. 1 Find a percent given a part and a whole.

12 of 35 students are majoring in mass communications. Write this as a percent.

[latex]\dfrac{12}{35}\approx 0.343 = \dfrac{343}{1000} = \dfrac{34.3}{100} = 34.3\%[/latex]

Ex. 2 Find the percentage of a whole.

What is 16% of 12,500? To find this number, you can translate the words into an equation.

“What” [latex]\longrightarrow x[/latex]

“is” [latex]\longrightarrow \hspace{.5cm}=[/latex]

“16%” [latex]\longrightarrow[/latex] 0.16

“of” [latex]\longrightarrow \hspace{.5cm} \ast[/latex]

12,500 [latex]\longrightarrow [/latex]  12500

[latex]x = 0.16 \ast 12500[/latex] Then solve for x.

[latex]x = 2000[/latex].

To check your work, see if 2000 out of 12,500 gives 16%.

[latex]\dfrac{2000}{12500}=0.16[/latex]. Converting that decimal to a percentage, we see that it does.

examples

For our vehicle color data, a pie chart might look like this:

Pie Chart titled "Vehicle color involved in total-loss collisions." Almost one quarter of the pie is green, then red, black, white, blue, and grey is the smallest slice.

Pie charts can often benefit from including frequencies or relative frequencies (percents) in the chart next to the pie slices. Often having the category names next to the pie slices also makes the chart clearer.

Pie Chart titled "Vehicle color involved in total-loss collisions." Almost one quarter of the pie is green (labeled Green, 52), then red (labeled Red, 41), black (labeled Black, 39), white (labeled White, 36), blue (labeled Blue, 25), and grey is the smallest slice (labeled Grey, 23).

This video demonstrates how to create pie charts like the ones above.


The pie chart below shows the percentage of voters supporting each candidate running for a local senate seat.

If there are 20,000 voters in the district, the pie chart shows that about 11% of those, about 2,200 voters, support Reeves.

Pie Chart labeled Voter preferences. Almost half the left side is black (labeled Elison, 46%), Most of the right is green (labeled Douglas, 43%), and a small portion near the bottom is red (labeled Reeves 11%).

The following video addresses how to read a pie chart like the one above.

Pie charts look nice, but are harder to draw by hand than bar charts since to draw them accurately we would need to compute the angle each wedge cuts out of the circle, then measure the angle with a protractor. Computers are much better suited to drawing pie charts. Common software programs like Microsoft Word or Excel, OpenOffice.org Write or Calc, or Google Drive are able to create bar graphs, pie charts, and other graph types. There are also numerous online tools that can create graphs.[2]

Try It

Create a bar graph and a pie chart to illustrate the grades on a history exam below.

A: 12 students, B: 19 students, C: 14 students, D: 4 students, F: 5 students

Don’t get fancy with graphs! People sometimes add features to graphs that don’t help to convey their information. For example, 3-dimensional bar charts like the one shown below are usually not as effective as their two-dimensional counterparts.3D Bar graph. Vertical measures Frequency, in increments of 5 from 0 to 55. Horizontal measures Vehicle color involved in a total-loss collision, showing from left Blue (25), Green (52), Red (41), White (36), Grey (23), Black (39). The tilted angle of the display makes it difficult to line up the top of the bar with the frequency numbers.

Here is another way that fanciness can lead to trouble. Instead of plain bars, it is tempting to substitute meaningful images. This type of graph is called a pictogram.

Pictogram

A pictogram is a statistical graphic in which the size of the picture is intended to represent the frequencies or size of the values being represented.

example

Two drawings of money bags, one on the left substantially larger than the one on the right. Left is labeled Manager Salaries, right is labeled Worker Salaries.A labor union might produce the graph to the right to show the difference between the average manager salary and the average worker salary.

Looking at the picture, it would be reasonable to guess that the manager salaries is 4 times as large as the worker salaries – the area of the bag looks about 4 times as large. However, the manager salaries are in fact only twice as large as worker salaries, which were reflected in the picture by making the manager bag twice as tall.

This video reviews the two examples of ineffective data representation in more detail.

Another distortion in bar charts results from setting the baseline to a value other than zero. The baseline is the bottom of the vertical axis, representing the least number of cases that could have occurred in a category. Normally, this number should be zero.

example

Compare the two graphs below showing support for same-sex marriage rights from a poll taken in December 2008[3]. The difference in the vertical scale on the first graph suggests a different story than the true differences in percentages; the second graph makes it look like twice as many people oppose marriage rights as support it.

Bar graph. Vertical measures Frequency (%), in increments of 10 from 0-100. Horizontal measures Do you support or oppose a same-sex marriage? Support (~40%), Oppose (~50%).Bar graph. Vertical measures Frequency (%), in increments of 5 from 40-60. Horizontal measures Do you support or oppose a same-sex marriage? Support (~43%), Oppose (~55%).

Try It

A poll was taken asking people if they agreed with the positions of the 4 candidates for a county office. Does the pie chart present a good representation of this data? Explain.nguyenmckee

This is the end of the section. Close this tab and proceed to the corresponding assignment.


  1. Gallup Poll. March 5-8, 2009. http://www.pollingreport.com/enviro.htm
  2. For example: http://nces.ed.gov/nceskids/createAgraph/ or http://docs.google.com
  3. CNN/Opinion Research Corporation Poll. Dec 19-21, 2008, from http://www.pollingreport.com/civil.htm