Boxplots in SPSS
Cheatsheet
This work was developed using resources that are available under a Creative Commons Attribution 4.0 International License, made available on the SOLES Open Educational Resources repository by the School of Life and Environmental Sciences, The University of Sydney.
About
The boxplot is a visual representation of a dataset’s distribution, showing the median, quartiles, and outliers. It is useful for comparing distributions between groups and identifying outliers within a single group.
- You have SPSS installed, ideally version 28.0 or later.
- You can follow instructions to select, click and drag elements in SPSS.
Your data should be structured in a way that makes it easy to plot. The ideal structure is long, i.e. one where each column represents a variable and each row an observation (Figure 1). You can either reshape your data in R or move cells manually in a spreadsheet program to achieve the desired structure. For boxplots comparing more than one group of data, a categorical variable representing the group should be present in the data.
Sex
is categorical and BW
is the measured, continuous response – is preferred over wide data (right), as it makes it easier to manipulate data when plotting.
1 Data
For this cheatsheet we will use part of the possums dataset used in BIOL2022 labs.
2 Import data
Open SPSS and import the data file:
File
>Open
>Data...
- Select the downloaded file
possum_bw.xlsx
- Check that the data is correctly identified( Figure 2) and click
OK
3 Plot
- Go to
Graphs
>Chart Builder...
- If a warning box appears on “measurement level”, click
OK
(should be safe to ignore and you can fix issues later).
- If a warning box appears on “measurement level”, click
- Select boxplot from the gallery at the bottom of the window.
- Drag the boxplot icon to the canvas.
- Drag the variable
Sex
to theX-Axis
box. - Drag the variable
BW
to theY-Axis
box. - Click
OK
to generate the plot.
4 Chart Editor
To make changes to the plot, double-click on the plot to open the Chart Editor
(Figure 4). Here you can make changes to the plot, such as:
- Titles: Click on the title to edit it.
- Axis labels: Click on the axis labels to edit them.
- Colours: Click on the elements you want to change and select a new colour.
- Outliers: Click on the outliers to select them and change their appearance.
- Error bars: Click on the error bars to change their appearance.
- Legend: Click on the legend to change its appearance.
You get the idea! Almost anything you click on can be edited. Play around with the options to customise your plot.