About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Question & Answer
Question
How can I add transition arrows between two variables into a scatter plot ?
Cause
When you are generating a scatter plot with variables that were computed from the same variable, they suffer a transition. In this case you would like to explicitly display the transition into the chart.
Answer
The plot has a measurement scale on the Y axis and you would like to see the difference between the initial value of the variable on the X axis and the value after various calculations applied to it. All these values are reported to the Y axis. The outcome will contain the small arrows and there will be one for every particular case in the .sav file.
In order to insert the small transition arrows into a scatter plot you need to run the syntax block from below. Please note that this solution only applies for variables that suffer a value transition.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=variable1 scale1 variable2 scale2 MISSING=VARIABLEWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: variable1=col(source(s), name("variable1"))
DATA: scale1=col(source(s), name("scale1"))
DATA: variable2=col(source(s), name("variable2"))
DATA: scale2=col(source(s), name("scale2"))
GUIDE: axis(dim(1), label("VARIABLE (years)"))
GUIDE: axis(dim(2), label("SCALE (units)"))
GUIDE: text.title(label("SCALE vs VARIABLE"))
SCALE: cat(aesthetic(aesthetic.color), map(("Scatter before transition", color.darkgrey),
("Scatter after transition", color.lightgrey)))
SCALE: linear(dim(2), include(0))
ELEMENT: point(position(variable1*scale1), color("Scatter before transition"), color.exterior(color.darkgrey))
ELEMENT: point(position(variable2*scale2), color("Scatter after transition"), color.exterior(color.lightgrey))
ELEMENT: edge(position(link.join(variable1*scale1 + variable2*scale2)), shape(shape.arrow))
ELEMENT: line(position(smooth.linear(variable1*scale1)), shape.interior(shape.dash))
ELEMENT: line(position(smooth.linear(variable2*scale2)), shape.interior(shape.line))
END GPL.
An example of this solution is approached in the attached files.
You will find there the data file (*.sav), the syntax file (*.sps) and the output file (*.spv).
Related Information
[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Statistics Desktop","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"19.0;20.0;21.0;22.0;23.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]
Was this topic helpful?
Document Information
More support for:
IBM SPSS Statistics
Software version:
19.0, 20.0, 21.0, 22.0, 23.0
Document number:
263851
Modified date:
16 April 2020
UID
swg21902534
Manage My Notification Subscriptions