• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Stacked bar graph

Page history last edited by Nathaniel Launer 7 years ago


     A stacked bar graph, also known as a segmented bar chart is a graph that displays the conditional distribution of a categorical variable within each category of another variable. The graph treats each bar as the "whole" and divides it proportionally into segments corresponding to the percentage in each group. The bars are normally plotted vertically but can be plotted horizontally


A stacked bar graph can clearly show whether or not the variables are associated.


A stacked bar graph does unfortunately have some deficiencies. It can be hard to compare the clustered variables. For Example, in the problem below, it would be vary hard to compare the "normal" group across the three age groups. Each age group bar might be the same size, but since the "normal" clustered variable is forced to sit on top of the "low" clustered variable they are not on the same level so we have no way to accurately compare it across the age groups. Overall this is the main problem with this type of graph and this deficiency only gets worse as more clustering variables are added, so this is not an ideal graph to use when you are trying to compare more than three variables.


For example, the problem we will illustrate gives you data on the blood pressure levels and age of a certain companies employees (Problem 37 Pg. 40 in Intro Stats 4th Edition book). One categorical variable measures the age of the employee with three sub-categories (Under 30, 30-49, and over 50) while the other variable measures the level of blood pressure with three sub-categories (low, normal, or high). To determine if these two variables are associated with each other we can use a stacked bar graph.



One can see the the outcomes of the employees blood pressure levels and how it is distributed among each age group. Although the amount of people in each age group differs, we set each age group (independent variable) to be 100%. This way, you can see what percentage in each age group has low, normal or high blood pressure. For example, there were more employees over the age of 50 tested but since we make each age group equal to 100%, it is the same height as the other bars so the percentages of people with low, normal or high blood pressure within this age group can be fairly compared with the other age groups. Creating stacked bar graphs with percentages in this way is useful because as you can see in this problem, by examining this graph you can determine that there is an association between age and blood pressure because as you can see, the older the employee was there were more cases of high blood pressure.


Creating a Stacked Bar Graph in SPSS

  • Once you have correctly entered the desired data into an SPSS table, click on the Graphs tab and select Chart Builder from the drop down menu.
  • In the Gallery choose the bar type and then click and drag the picture of the segmented bar graph into the chart preview frame.
  • Click and drag your categorical variables on the left into the correct spots in the chart preview frame. The predicting/ independent variable in the x-axis spot, and the response/dependent variable in the segmented spot. (The unoccupied y-axis spot will become the count of the data, or better yet, change it to percentages in the Element Properties menu for the best comparison of data)
  • Once the independent and dependent variables are in the correct spots, click OK to create the graph. SPSS will open the created graph in a new window.
  • (Optional) If your sub-categories are out of order and could be displayed better (such as in ascending or descending order) you can change this. To change it, double click the picture of the graph to open the Chart Editor. In the Chart Editor double click the x-axis label to bring up the editing menu. Click on Categories in the Properties window that appears and then select the sub-category which you wish to rearrange and use the up or down arrows on the right to change its place in the order. You can also rearrange the order in which the variables are stacked in the bars (the clustered variables) by using this same method (double-clicking on them). Click Apply and then close both this menu and the Chart Editor window. (Any aspect of the graph can be changed by bringing up the chart editor window and double-clicking on the desired aspect to bring up it's property menu) 


F    Follow these video instructions to fully complete a stacked bar graph:

Unable to display content. Adobe Flash is required.











Comments (1)

Michael Day said

at 8:54 pm on Nov 11, 2013

Michael Day + Nate Launer

You don't have permission to comment on this page.