# Analysing a single scale variable

## 1b: Visualisation

In the previous part we got a first impression of the data, but it might be good to also visualise the results. Two commonly diagrams that could be used is the histogram and a box plot. I will explain use the histogram here, but for the interested reader the box plot is discussed in appendix at the bottom of this page.

To illustrate a histogram we start with showing what we would get if we simply drew a bar-chart of the scale variable as shown in Figure 1.

*Figure 1*. Bar chart of a scale variable.

In the bar-chart for each chosen age a bar is drawn with the height of the counts. In section 2.2 the bar-chart was discussed in more detail, but there are so many bars that for a scale variable this often is not very insightful. To reduce the number of bars, the scale variable is often recoded into categories (bins), as we also did in the previous section. If the bins are then of equal width (size) we get the bar-chart shown in Figure 2.

*Figure 2*. Bar chart of a binned scale variable

To emphasize that we actually have the original scores, and did not ask on the survey for the age category (but really simply their age), the bars are placed next to each other and the horizontal scale becomes a number line. This chart is then no longer called a bar-chart, but a histogram. Figure 3 show the histogram of the age of the respondents.

*Figure 3*. Histogram of scale variable.

**Click here to see how to create a simple histogram with SPSS, R (Studio), Excel, or Python**

**with SPSS**

There are a four different ways to create a histogram with SPSS.

*using Chart Builder*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using Legacy Dialogs*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using Frequencies*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using Explore*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

**with R (Studio)**

**with Excel**

Two videos, one on how to create a simple histogram when bin sizes are equal, and one for unequal

*equal class widths Excel 2007-2013*

*equal class widths Excel 2016-2019*

*unequal class widths*

**with Python**

Originally a histogram should also make use of something known as frequency densities (Pearson, 1895, p. 399), but if you keep the width of each bin the same, this can be ignored.

When showing a chart it is good to also talk a little bit about it. For a scale variable you might want to describe the shape of the histogram. It of course always depends on your specific data, but inform your reader what you notice from the graph or what you want to show.

An alternative for a histogram that is sometimes used is a box-plot. This diagram however requires knowledge of quartiles, and outliers. Although a box-plot might in some cases be a better diagram to use then a histogram, you should also wonder if your reader(s) will understand a box-plot. A histogram is often easily understood, by people but a box-plot isnâ€™t. In the appendix below you can read more on box plots

Besides a frequency table and it's visualisation, we can also use some measurements to describe the data. This is the topic for the next section.

**Single scale variable**

Google adds