This is a complimentary tip available only to SPSS Direct subscribers.
Using SPSS for Windows, I would like to create a dual-Y axes chart. I want to plot years of experience as a bar chart on one Y axis and salary as a line on a second Y axis. I have a categorical variable, Gender, that I would like to use for my X axis. How can I create this as one chart?
This depends on which version of SPSS for Windows you use. SPSS 15.0 for Windows introduced several new features in the Chart Builder interface. One of these supports the creation of dual-Y axes charts. Although the menu items were not present in SPSS 14.0 for Windows, you can still create these charts using Graphics Production Language (GPL) syntax.
In SPSS 15.0 for Windows, a chart with dual-Y axes can be created by opening the Chart Builder (Graphs>Chart Builder). Once in Chart Builder, click the Basic Elements tab and drag the Dual Y Axes icon from the Axis Options onto the canvas. Next, go to Element Options and drag the Bar icon to the canvas.
Figure 1: : The dual axes and the bar element are selected in Chart Builder.
(Click to enlarge)
The bar will be used for the variable on the first Y axis, which is the one on the left. Then, add the element for the second Y axis by dragging the Line icon onto the canvas. You can use other graphic elements, but not all graphic elements are available in a dual Y-axes chart.
We can now associate the variables we want to use with their respective axes. Drag Gender, the categorical variable, to the X-axis drop zone. Both Y axes default to “count,” but you can drag the Current Salary variable to the rightmost Y axis (for the line element). The statistic can be changed here from “count” to “mean.” Finally, drag the Years Experience variable to the left-hand Y axis to define the chart’s bars.
Figure 2: Here’s the dual-Y axes definition in Chart Builder.
(Click to enlarge)
As shown in Figure 3 below, the resulting graph displays bars for mean years of previous experience and a line representing the mean salary. Both are broken down by gender.
Figure 3: Output showing dual axis chart.
(Click to enlarge)
If you are working with SPSS 14.0 for Windows or prefer to use Syntax to generate charts, the corresponding syntax is included below:
* Chart Builder.For more information on using GPL syntax, please refer to the GPL Reference Guide available on the Technical Support Web site. Additional details regarding the new Chart Builder features and GPL syntax are accessible in the SPSS online help as well.
Predictive Analytics
can make your organization
more
successful