Login
📚 Contemporary Mathematics
Chapters ▾
⇩ Download ▾

8.2 Visualizing Data

A group of people are at a table, with their hands shown holding pens. They're all pointing to data on a piece of paper.
Figure 8.4 Data visualizations can help people quickly understand important features of a dataset.Data visualizations can help people quickly understand important features of a dataset. (credit: "Group of diverse people having a business meeting" by Rawpixel Ltd/Flickr, CC BY 2.0)

Learning Objectives

After completing this section, you should be able to:

  1. Create charts and graphs to appropriately represent data.
  2. Interpret visual representations of data.
  3. Determine misleading components in data displayed visually.

Summarizing raw data is the first step we must take when we want to communicate the results of a study or experiment to a broad audience. However, even organized data can be difficult to read; for example, if a frequency table is large, it can be tough to compare the first row to the last row. As the old saying goes: a picture is worth a thousand words (or, in this case, summary statistics)! Just as our techniques for organizing data depended on the type of data we were looking at, the methods we’ll use for creating visualizations will vary. Let’s start by considering categorical data.

Visualizing Categorical Data

If the data we’re visualizing is categorical, then we want a quick way to represent graphically the relative numbers of units that fall in each category. When we created the frequency distributions in the last section, all we did was count the number of units in each category and record that number (this was the frequency of that category). Frequencies are nice when we’re organizing and summarizing data; they’re easy to compute, and they’re always whole numbers. But they can be difficult to understand for an outsider who’s being introduced to your data.

Let’s consider a quick example. Suppose you surveyed some people and asked for their favorite color. You communicated your results using a frequency distribution. Jerry is interested in data on favorite colors, so he reads your frequency distribution. The first row shows that twelve people indicated green was their favorite color. However, Jerry has no way of knowing if that’s a lot of people without knowing how many people total took your survey. Twelve is a pretty significant number if only twenty-five people took the survey, but it’s next to nothing if you recorded a thousand responses. For that reason, we will often summarize categorical data not with frequencies, but with proportions. The proportion of data that fall into a particular category is computed by dividing the frequency for that category by the total number of units in the data.

Proportion of a category=Category frequencyTotal number of data units

Proportions can be expressed as fractions, decimals, or percentages.

Now that we can compute proportions, let’s turn to visualizations. There are two primary visualizations that we’ll use for categorical data: bar charts and pie charts. Both of these data representations work on the same principle: If proportions are represented as areas, then it’s easy to compare two proportions by assessing the corresponding areas. Let’s look at bar charts first.

Bar Charts

A bar chart is a visualization of categorical data that consists of a series of rectangles arranged side-by-side (but not touching). Each rectangle corresponds to one of the categories. All of the rectangles have the same width. The height of each rectangle corresponds to either the number of units in the corresponding category or the proportion of the total units that fall into the category.

In practice, most graphs are now made with computers. You can use Google Sheets, which is available for free from any web browser.

Now that we’ve explored how bar graphs are made, let’s get some practice reading bar graphs.

Pie Charts

A pie chart consists of a circle divided into wedges, with each wedge corresponding to a category. The proportion of the area of the entire circle that each wedge represents corresponds to the proportion of the data in that category. Pie charts are difficult to make without technology because they require careful measurements of angles and precise circles, both of which are tasks better left to computers.

Pie charts are sometimes embellished with features like labels in the slices (which might be the categories, the frequencies in each category, or the proportions in each category) or a legend that explains which colors correspond to which categories. When making your own pie chart, you can decide which of those to include. The only rule is that there has to be some way to connect the slices to the categories (either through labels or a legend).

Visualizing Quantitative Data

There are several good ways to visualize quantitative data. In this section, we’ll talk about two types: stem-and-leaf plots and histograms.

Stem-and-Leaf Plots

Stem-and-leaf plots are visualization tools that fall somewhere between a list of all the raw data and a graph. A stem-and-leaf plot consists of a list of stems on the left and the corresponding leaves on the right, separated by a line. The stems are the numbers that make up the data only up to the next-to-last digit, and the leaves are the final digits. There is one leaf for every data value (which means that leaves may be repeated), and the leaves should be evenly spaced across all stems. These plots are really nothing more than a fancy way of listing out all the raw data; as a result, they shouldn’t be used to visualize large datasets.

This concept can be difficult to understand without referencing an example, so let’s first look at how to read a stem-and-leaf plot.

Stem-and-leaf plots are useful in that they give us a sense of the shape of the data. Are the data evenly spread out over the stems, or are some stems “heavier” with leaves? Are the heavy stems on the low side, the high side, or somewhere in the middle? These are questions about the distribution of the data, or how the data are spread out over the range of possible values.

Some words we use to describe distributions are uniform (data are equally distributed across the range), symmetric (data are bunched up in the middle, then taper off in the same way above and below the middle), left-skewed (data are bunched up at the high end or larger values, and taper off toward the low end or smaller values), and right-skewed (data are bunched up at the low end, and taper off toward the high end). See below figures.

Four histograms. The first histogram is titled, Uniform. The horizontal axis ranges from 0 to 5, in increments of 1. The vertical axis ranges from 0 to 60, in increments of 10. The histogram infers the following data. 0 to 1: 38. 1 to 2: 35. 2 to 3: 51. 3 to 4: 39. 4 to 5: 37. The second histogram is titled, Right-skewed. The horizontal axis ranges from 1 to 21, in increments of 2. The vertical axis ranges from 0 to 50, in increments of 10. The histogram infers the following data. 1 to 3: 18. 3 to 5: 40. 5 to 7: 44. 7 to 9: 37. 9 to 11: 29. 11 to 13: 14. 13 to 15: 8. 15 to 17: 5. 17 to 19: 3. 19 to 21: 2. The third histogram is titled, Left-skewed. The horizontal axis ranges from 30 to 50, in increments of 2. The vertical axis ranges from 0 to 60, in increments of 10. The histogram infers the following data. 30 to 32: 3. 32 to 34: 1. 34 to 36: 6. 36 to 38: 11. 38 to 40: 13. 40 to 42: 31. 42 to 44: 39. 44 to 46: 52. 46 to 48: 35. 48 to 50: 8. The fourth histogram is titled, Symmetric. The horizontal axis ranges from 30 to 180, in increments of 15. The vertical axis ranges from 0 to 80, in increments of 10. The histogram infers the following data. 30 to 45: 2. 45 to 60: 7. 60 to 75: 20. 75 to 90: 31. 90 to 105: 70. 105 to 120: 30. 120 to 135: 29. 135 to 150: 10. 150 to 165: 2. 165 to 180: 1. Note: all values are approximate.
Figure 8.17

Looking back at the stem-and-leaf plot in the previous example, we can see that the data are bunched up at the low end and taper off toward the high end; that set of data is right-skewed. Knowing the distribution of a set of data gives us useful information about the property that the data are measuring.

Now that we have a better idea of how to read a stem-and-leaf plot, we’re ready to create our own.

As we mentioned above, stem-and-leaf plots aren’t always going to be useful. For example, if all the data in your dataset are between 20 and 29, then you’ll just have one stem, which isn’t terribly useful. (Although there are methods like stem splitting for addressing that particular problem, we won’t go into those at this time.) On the other end of the spectrum, the data may be so spread out that every stem has only one leaf. (This problem can sometimes be addressed by rounding off the data values to the tens, hundreds, or some other place value, then using that place for the leaves.) Finally, if you have dozens or hundreds (or more) of data values, then a stem-and-leaf plot becomes too unwieldy to be useful. Fortunately, we have other tools we can use.

Histograms

Histograms are visualizations that can be used for any set of quantitative data, no matter how big or spread out. They differ from a categorical bar chart in that the horizontal axis is labeled with numbers (not ranges of numbers), and the bars are drawn so that they touch each other. The heights of the bars reflect the frequencies in each bin. Unlike with stem-and-leaf plots, we cannot recreate the original dataset from a histogram. However, histograms are easy to make with technology and are great for identifying the distribution of our data. Let’s first create one histogram without technology to help us better understand how histograms work.

Now that we’ve seen the connection between stem-and-leaf plots and histograms, we are ready to look at how we can use Google Sheets to build histograms.

Let’s use Google Sheets to create a histogram for a large dataset.

Bar Charts for Labeled Data

Sometimes we have quantitative data where each value is labeled according to the source of the data. For example, in a set of in-state tuition data, each value is associated with a school; the schools are the labels. In YOUR TURN 8.11, you found a histogram of the wins of every Major League Baseball team in 2019. Each of those win totals had a label: the team. If we’re interested in visualizing differences among the different teams, or schools, or whatever the labels are, we create a different version of the bar graph known as a bar chart for labeled data.

These graphs are made in Google Sheets in exactly the same way as regular bar graphs. The only change is that the vertical axis will be labeled with the units for your quantitative data instead of just “Frequency.”

Misleading Graphs

Graphical representations of data can be manipulated in ways that intentionally mislead the reader. There are two primary ways this can be done: by manipulating the scales on the axes and by manipulating or misrepresenting areas of bars. Let’s look at some examples of these.

Key Terms

  • proportion
  • bar chart
  • pie chart
  • stem-and-leaf plot
  • distribution (of quantitative data)
  • histogram
  • bar chart for labeled data

Key Concepts

  • Categorical data can be visualized using pie charts or bar charts; quantitative data can be visualized using stem-and-leaf plots or histograms.
  • Areas in pie charts and bar charts represent proportions of the data falling into a particular category, while areas in histograms represent proportions of the data that fall into a given range of data values (or “bins”). Stem-and-leaf plots are visual representations of entire datasets.
  • By manipulating the axes, changing widths of bars, or making bad choices for bins, we can create data visualizations that misrepresent the distribution of data.

Videos

Adapted from Contemporary Mathematics by OpenStax (openstax.org), licensed under CC BY-NC-SA 4.0. Changes were made. License: CC-BY-NC-SA-4.0.