Skip to main content
Mathematics LibreTexts

8.2: Presenting Categorical Data Graphically

  • Page ID
    139293
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    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 possible values of the variable, and the other lists the corresponding frequency for each value (how many items fit into each category).

    Many times a 3rd column is added, called the relative frequency column. The relative frequency expresses the frequency of each possible value, relative to the whole. Relative frequencies can be written as fractions, decimals, or percentages.

    Example \(\PageIndex{1}\)

    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

    Solution

    When you add together the frequencies for each possible value of the variable, you end up with the total number of observed values. In this case, that total is 216.

    If we wanted to add a relative frequency column, we would find the relative frequency for each color by dividing the corresponding frequency by the total number of observations. The new table would be as follows:

    Color

    Frequency

    Relative Frequency

    Blue

    25

    \(\frac{25}{216}=.1157=11.57 \%\)

    Green

    52

    \(\frac{52}{216}=.2407=24.07 \%\)

    Red

    41

    \(\frac{41}{216}=.1898=18.98 \%\)

    White

    36

    \(\frac{36}{216}=.1667=16.67 \%\)

    Black

    39

    \(\frac{39}{216}=.1806=18.06 \%\)

    Grey

    23

    \(\frac{23}{216}=.1065=10.65 \%\)

    Note: The relative frequency column should always sum to 1 (or 100%) since you are representing the entire data set.

    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 histograms 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, and represents the possible values of the variable of interest. The construction of a bar chart is most easily described by use of an example.

    Example \(\PageIndex{2}\)

    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:

    Solution

    clipboard_e45a7d15a35a0f0b78405e089c25fbfad.png

    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:

    clipboard_e55f2901f775ba54c5dd950d7b8801b04.png

    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

    Example \(\PageIndex{3}\)

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

    Solution

    clipboard_e9f91279592d3c200f187b377997316f7.png

    Example \(\PageIndex{4}\)

    In a survey 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

    Solution

    This data could be shown graphically in a bar graph:

    clipboard_e4b19501065cdf82f21cd63b06a09fe6b.png

    Exercise \(\PageIndex{5}\)

    Create a frequency table and bar graph to illustrate the grades on a history exam below.
    A: 12 students, B: 19 students, C: 14 students, D: 4 students, F: 5 students

    Answer

    clipboard_efaaebc21811142b9155864e6126a2864.png

    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. These relative frequencies are usually expressed as a percentage.

    Example \(\PageIndex{6}\)

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

    Solution

    clipboard_e21bd317599a5bfff1b009fb66fa2eb25.png

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

    clipboard_e8472273ccef162031b6f334302caf19a.png

    Example \(\PageIndex{7}\)

    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.

    clipboard_e5a34b5109ebfc6be60e4768808bcc151.png

    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 Docs are able to create bar graphs, pie charts, and other graph types. There are also numerous online tools that can create graphs.

    Exercise \(\PageIndex{8}\)

    Logan categorized his spending for this month into four categories: Rent, Food, Fun, and Other. The percentages he spent in each category are pictured here. If Logan spent a total of $2400 this month, how much did he spend on Food?

    clipboard_e1ecfabffbcae49c770eb62316c247ecc.png

    Answer

    $2400(.23) = $552

    Don’t get fancy with graphs! Peopleclipboard_e44828c6175c8ac7c5d5de26974c1bd67.png
    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.

    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 \(\PageIndex{9}\)

    A labor union might produce the graph to the right toclipboard_ea4373733122d8124eccaef6e4bb8fd42.png
    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.

    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 \(\PageIndex{10}\)

    Compare the two graphs below showing support for same-sex marriage rights from a poll taken in December, 200814. 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.

    clipboard_eb7065e8709edbf10010738a6b36838ab.png

    Exercise \(\PageIndex{1}\)

    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.

    clipboard_e40bb42db69478d40850fe04614c2316d.png

    Answer

    While the pie chart accurately depicts the relative size of the people agreeing with each candidate, the chart is confusing, since usually percentages on a pie chart represent the percentage of the pie that the slice represents


    8.2: Presenting Categorical Data Graphically is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?