Chapter 9 Bar chart

9.1 Intro

Bar charts are normally used to inspect the distribution of categorical (dichotomous, nominal or ordinal) variables.

9.1.1 Example dataset

This example uses the Rosetta Stats example dataset “pp15” (see Chapter 1 for information about the datasets and Chapter 3 for an explanation of how to load datasets).

9.1.2 Variable(s)

From this dataset, this example uses variable currentEducation.

9.2 Input: jamovi

A screenshot placeholder

Figure 9.1: A screenshot placeholder

9.3 Input: R

Use the following command (this requires the rosetta package to be installed, see section 2.3.2, and the example dataset to be stored under name dat, see section 3):

rosetta::ggBarChart(dat$currentEducation);

For more advanced stuff, visit the Rosetta Stats Pro: SPSS to R book.

9.4 Input: SPSS GUI

First activate the pp15 dataset by clicking on it (see 2.4.1).

Open the “Graphs” menu and select the “Chart Builder” option as shown in Figure ??.

Opening the "Chart Builder" option in SPSS.

Figure 9.2: Opening the “Chart Builder” option in SPSS.

In the “Chart Builder” dialog, select “Bar” from “Gallery” and drag “Simple Bar” to the “Chart Preview” as shown in Figure 9.3.

Selecting Bar Chart from the Chart Builder in SPSS

Figure 9.3: Selecting Bar Chart from the Chart Builder in SPSS

Under the “Variables” menu, select “currentEducation” and drag it onto the “X-Axis?” option in “Chart Preview” as shown in Figure 9.4. Note that there are options to modify the aesthetics of the graph on the right side of the screen under “Element Properties”, “Chart Appearance”, and “Options”.

Adding the variable to the bar chart in SPSS.

Figure 9.4: Adding the variable to the bar chart in SPSS.

9.5 Input: SPSS Syntax

Use the following command (this requires the dat dataset to be the active dataset, see 2.4.1):

THIS COMMAND HAS YET TO BE ADDED

9.6 Output: jamovi

A screenshot placeholder

Figure 9.5: A screenshot placeholder

9.7 Output: R

The produced box plot in R.

Figure 9.6: The produced box plot in R.

9.8 Output: SPSS

The box plot produced in SPSS.

Figure 9.7: The box plot produced in SPSS.

9.9 Read more

If you would like more background on this topic, you can read more in these sources:

References

Navarro, Danielle. 2018. Learning Statistics with R. 0.6 ed. New South Wales, Australia. https://learningstatisticswithr.com/.