Login

Creating a Clustered Bar Chart using SPSS Statistics

Introduction

A clustered bar chart is helpful in graphically describing (visualizing) your data. It will often be used in addition to inferential statistics. A clustered bar chart can be used when you have either: (a) two nominal or ordinal variables and want to illustrate the differences in the categories of these two variables based on some statistic (e.g., a count/frequency, percentage, mean, median, etc.); or (b) one continuous or ordinal variable and two nominal or ordinal variables and want to illustrate the differences in the continuous variable (which typically acts as a dependent variable) in terms of the categories of the two nominal or ordinal variables (which typically act as independent variables). For example, a clustered bar chart can be appropriate if you are analysing your data using a chi-square test for association, a two-way ANOVA, two-way repeated measures ANOVA, and two-way mixed ANOVA.

Note: If you are using an an independent-samples t-test, paired-samples t-test (dependent t-test), one-way ANOVA or repeated measures ANOVA, you might want to consider a simple bar chart instead.

For example, a clustered bar chart could be used to illustrate the differences in the number of times shoppers preferred one of 5 different brands of ice cream when eating at home compared to eating out (i.e., the statistic being measured could be a "count/frequency", and the two variables, which are both nominal, would be "brand preference" – which has five categories: "ice cream brand A", "ice cream brand B", "ice cream brand C", "ice cream brand D" and "ice cream brand E" – and "place of consumption", which has two categories: "at home" and "eating out").

Alternatively, a clustered bar chart could be used to illustrate the differences in the continuous dependent variable, cholesterol, based on the ordinal independent variable, physical activity level (i.e., consisting of four levels to represent the "sedentary", "low", "moderate" and "high" physical activity groups who participated in a study) and the nominal variable: gender (i.e., consisting of two categories: "males" and "females"). Alternatively, a clustered bar chart could be used to illustrate the differences in the ordinal dependent variable, satisfaction level (consisting of five levels to represent how satisfied customers felt: "very satisfied", "somewhat satisfied", "neither satisfied nor dissatisfied", "somewhat dissatisfied" and "very dissatisfied"), based on two nominal independent variables: mobile phone brand (consisting of four groups: "Apple", "Nokia", "Samsung", and "Sony") and a second, nominal independent variable, US mobile carriers (consisting of three groups: "AT&T", "Sprint" and "Verizon Wireless").

The purpose of this guide is to show you how to create a clustered bar chart using SPSS Statistics. First, we introduce the example we have used in this guide. Next, we show how to use the Chart Builder in SPSS Statistics to create a clustered bar chart based on whether you have SPSS Statistics versions 27 or 28 (or the subscription version of SPSS Statistics), versions 25 or 26, or version 24 or an earlier version of SPSS Statistics. If you are unsure which version of SPSS Statistics you are using, see our guide: Identifying your version of SPSS Statistics.

SPSS Statistics

Example

A researcher was interested in whether an individual's interest in politics was influenced by their level of education and their gender. The researcher recruited a random sample of participants and asked them about their interest in politics, which they scored from 0 - 100 with higher scores indicating a greater interest. The researcher then divided the participants by gender (Male/Female), and then again by level of education (School/College/University).

Therefore, this guide shows you how to create a clustered bar chart of the continuous dependent variable, political_interest (i.e., representing a person's 'interest in politics'), against the nominal independent variable, gender (which has two categories: "Male" and "Female"), and the ordinal independent variable, education_level (i.e., representing a person's highest educational qualification, which has three levels: "School", "College" and "University"). This guide will also show you how to add error bars (in this case, using confidence intervals).

Note: The example is based on the data from our introductory two-way ANOVA guide. If you want to analyse your data using a two-way ANOVA, our introductory guide will help get you started.

Testimonials
TAKE THE TOUR


SPSS Statistics

SPSS Statistics procedure for versions 27 and 28
(and the subscription version of SPSS Statistics)

The 11 steps that follow show you how to create a clustered bar chart in SPSS Statistics versions 27 and 28 (and the subscription version of SPSS Statistics) using the example above.

  1. Click Graphs > Chart Builder... on the main menu, as shown below:
    'Chart Builder' menu for a clustered bar chart in SPSS Statistics

    Published with written permission from SPSS Statistics, IBM Corporation.


    You will be presented with the Chart Builder dialogue box, as shown below:
    'Chart Builder' dialogue box for a clustered bar chart in SPSS Statistics

    Published with written permission from SPSS Statistics, IBM Corporation.

  2. Select "Bar" from the Choose from: box in the bottom-left-hand corner of the Chart Builder dialogue box, as highlighted below:
    The 'Bar' option is highlighted

    Published with written permission from SPSS Statistics, IBM Corporation.

  3. Selecting "Bar" will present eight different bar chart options in the lower-middle section of the Chart Builder dialogue box (as shown above and below). Drag-and-drop the option that is second from the left on the top row (you will see it labelled as "Clustered Bar" if you hover your mouse over the box) into the main chart preview pane, as shown below:
    8 different bar chart options are presented. The 'Clustered Bar' option is dragged into the 'Chart Preview' box at the top

    Published with written permission from SPSS Statistics, IBM Corporation.

  4. You will be presented with the screen below, which shows a clustered bar chart in the main chart preview pane with boxes for the y-axis ("Y-Axis?"), x-axis ("X-Axis?") and "Cluster on X: set color" for you to populate with the appropriate variables.
    The 'Chart Preview' pane changes, simply highlighting you are going to create a clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

    Note: You can ignore the "Filter?" box.

  5. Drag-and-drop the independent variable, education_level, from the Variables: box into the "X-Axis?" box in the main chart preview screen. Do the same for the dependent variable, political_interest, but into the "Y-Axis?" box. Next, drag the independent variable, gender, into the "Cluster on X: set color" box. You should end up with a screen like below:
    The 'Chart Preview' changes to reflect the variables you have entered into the a-axis, y-axis & 'Cluster on X' of your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

    Note 1: The chart preview pane does not accurately plot the variable data that you have dragged across in its preview pane, even though it might appear that it does due to the bar chart's bars changing when you add your variables. Therefore, do not get confused and think that you have done something wrong. You will only see your true data when you actually generate the clustered bar chart.

    Note 2: You could easily swap the two independent variables around without any problems. The reason for the order used in this guide is due to the way in which the two-way ANOVA problem is phrased, such that it is preferable to compare gender at each level of education_level in this particular example.

  6. Click Display error bars in the element properties dialogue box, which will activate the –Error Bars Represent– area. Select Confidence intervals and Level (%): set at 95. You will be presented with the following screen:
    The 'Element Properties' dialogue box provides further options to edit your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

    Note 1: You do not have to select error bars, but it is common in academia to do so. We illustrate a clustered bar chart with and without error bars at the end of the guide.

    Note 2: You can use this area to select other types of error bars, such as multiples of either the standard error or standard deviation.

  7. Click on "Y-Axis1 (Bar1)" in the element properties dialogue box and you will be presented with the following screen:
    You can now make changes to the y-axis of your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

    Note: You can use this dialogue box to change the axis label (using the Axis Label: box) and/or change scale attributes using the options in the –Scale Range– area.

  8. If you want to change the scale on the y-axis of the dependent variable, political_interest, for example, the minimum value, uncheck the Minimum option in the –Scale Range– area so that the Custom value is highlighted and has a value of 0 (zero), as shown below. In this example, everything is OK as it is.
    You can now make changes to the y-axis of your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

    Note: The procedure above is intended to make the y-axis show a suitable range of values for political_interest. These values might be different for your variables, so you should adjust them as you see fit. If you are not sure at first what these values should be, don't change the values; see what the clustered bar chart looks like and then re-run the clustered bar chart with new axes values if necessary. You can also re-edit the clustered bar chart later on.

  9. If you want to change the order of the categories of the independent variable that you have placed on the x-axis (i.e., the independent variable, education_level), click on "X-Axis1 (Bar1)" in the Edit Properties of: box. This will activate the –Categories– and –Small/Empty Categories– areas, as well as the Legend Label: option. Leave the default options selected. However, if you want to change the order of the categories of the independent variable, you can do this in the Order: box in the –Categories– area using the Up and Down arrows. In this example, everything is OK as it is.
    Presents options where you can make changes to the x-axis of your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

  10. You can also change the order of the categories of the independent variable that was entered into the "Cluster on X: set color" box (i.e., the independent variable, gender) by clicking on "GroupColor (Bar1)" in the Edit Properties of: box and then following the procedure above (i.e., use the Up and Down arrows to change the order of the categories in the Order: box). The element properties dialogue box when "GroupColor (Bar1)" is selected is shown below:
    Presents options where you can make changes to 'Cluster on X' for your clustered bar chart

    Published with written permission from SPSS Statistics, IBM Corporation.

  11. Click on the OK button in the Chart Builder dialogue box to generate the clustered bar chart, as shown below:
Clustered bar chart showing 'political_interest' by 'education_level' by 'gender'

Published with written permission from SPSS Statistics, IBM Corporation.

Note: If the type of clustered bar chart that you want to create is different from the example above or there are specific options you want to include in your clustered bar chart that we have not covered, please contact us. We will try to add a section to the guide that deals with the type of clustered bar chart you want to create.

Join the 10,000s of students, academics and professionals who rely on Laerd Statistics.TAKE THE TOUR
next »