Login
📚 Statistical Inference for Everyone
Chapters ▾

3.5 Visualization of Data

There are two main methods of visualizing data, and several others that are related to these methods. In this section we introduce just two, histograms and scatter plots, and we will use these throughout the text.

Histograms

Histograms are a way of summarizing data, when presenting the entire data set is impractical, or where some understanding of the data is made clearer by summarizing. The histogram plot is done with the following steps:

  1. Choose a number of bins to divide the data.
  2. Count up the data that fall into each bin
  3. Make a bar plot, or a scatter plot to present the data.

The following is an example with a small data set. The process of binning and counting is often done by computer, but it is instructive to perform the process by hand a few times in order to understand what the results are.

Table 3.3 shows a collection of 106 heights (in centimeters) of the male students in a class. As a collection of numbers it is relatively opaque, but as a histogram it is clearer.

Table 3.3. 106 Male Student Heights (in cm) from a Survey.
177.8160.0165.0182.88175.0167.0
182.88190.5177.0190.5180.34180.34
184.0172.72175.26167.0180.0180.0
190.0182.5185.0171.0172.0180.34
180.0170.0200.0190.0170.18179.0
182.0171.0177.8175.26187.0183.0
180.0176.0185.42176.5167.64179.0
183.0179.0190.0165.0187.0170.0
180.0180.34190.5185.0193.04184.0
177.0180.0175.26180.34178.5187.96
178.0175.26189.0182.88170.0180.0
185.0187.96185.42195.0172.72180.34
173.0187.96187.0168.0191.8177.0
189.0180.34182.88172.72172.0170.0
175.0168.0165.0173.0196.0179.1
180.0176.0154.94174.0179.1160.0
165.0165.0170.0185.0188.0171.0
185.0185.0180.34183.0
Histogram of 100 male heights in centimeters using a moderate number of bins. Bars span roughly 155 cm to 203 cm, with a tall spike of 28 people near 178 cm and most heights between 170 and 190 cm.

From this histogram, we can immediately observe several quantities which summarize their data:

  1. The average value (around the middle) should be around 175 cm. The actual value can be calculated from the data, as

    x¯=177.8+160.0++180.34+183.0106=178.83

  2. The range of the data is around 155 cm up to about 205 cm. Again we can be more precise, and find the minimum of the data (154.94 cm) and the maximum (200 cm) but the histogram picture yields an approximate value instantly.
  3. The values are roughly symmetric about the mean (i.e. average) value. This can give us a clue concerning how to model the data.

What is quite clear is that it is far easier to deal with a histogram, as above, than find the same information from the table of numbers.

Too Few Bins

Plotting the same histogram with too few bins might look like:

The same male-height data drawn with only three very wide bins: a tiny bar below 163 cm, one dominant bar of over 80 people covering roughly 163-186 cm, and a bar of about 20 people above that. Nearly all detail of the distribution is lost.

Clearly all the information is washed out.

Too Many Bins

Plotting the same histogram with too many bins might look like:

The same male-height data drawn with far too many narrow bins: dozens of ragged bars of mostly 1-6 people, a lone spike of 16 at exactly 180 cm, and many empty gaps — the overall shape is obscured by noise.

We lose any of the summary information here, where we essentially have one bar for each data-point.

Scatter Plots

A scatter plot is used to explore the relationship between two values. For example, in the survey of male students, in addition to height the students also measured the width of their writing hand viewed as a histogram, here

Histogram of writing-hand spans in centimeters for the survey class. Bars run from 16 to just past 23 cm, climbing to a broad peak of about 13 people near 18.5-19 cm, then declining with smaller secondary bumps near 22 and 23 cm.

However, due to the possibility that these two variables could be related, it makes more sense to make a scatter plot. In such a plot, one designates one variable as “x” and another as “y,” and places a single dot for each pair of values in the data set. Thus, each dot on the plot corresponds to height and hand-width for a single student.

Scatter plot of writing hand span (16-23 cm) versus height (155-200 cm) for about 100 students, with a dashed trend line rising from about 18 cm span at 155 cm height to 22 cm span at 205 cm height. Points scatter widely around the line, showing a weak positive relationship.

What we can see here, which was obscured with a histogram, is the relationship between these values - for the taller students, their hands are wider. We will explore quantifying this relationship later, but much can be done by eye using a scatter plot.

Adapted from Statistical Inference for Everyone, by Brian Blais (Bryant University), licensed under CC BY-SA 4.0 (dual-licensed under the GNU FDL 1.2 or later; this adaptation uses the CC BY-SA grant). Changes were made; this adaptation is distributed under the same license. License: CC-BY-SA-4.0.