Is it possible to invert an axis in an SPSS graph, say from -1,0,1 to 1,0,-1 without using code?I have only been able to change the axes' coordination from x to y and reverse which was not what I wanted. I know inverting is possible with a code (or so they say in some forums) but I have zero knowledge on programming and I would prefer an easier way if such a way exists.
Asked
Active
Viewed 4,564 times
2 Answers
2
It's ok if you don't have programming knowledge. You do indeed need code to do this, but it is still very easy. If you can copy/paste, you can reverse an axis. Follow these steps:
- make your graph in chart builder like you normally would
- instead of pressing "OK" to graph, press "Paste"
- your syntax window will show some chart code.
Here's an example:
* Chart Builder.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=var1 var2 MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: var1=col(source(s), name("var1"))
DATA: var2=col(source(s), name("var2"))
GUIDE: axis(dim(1), label("X"))
GUIDE: axis(dim(2), label("Y"))
ELEMENT: point(position(var1*var2))
END GPL.
- simply paste this
SCALE: linear(dim(1), reverse())
somewhere betweenBEGIN GPL
andEND GPL
(note: change dim(1)
to dim(2)
before you paste if you want to reverse the y axis)
* Chart Builder.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=var1 var2 MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: var1=col(source(s), name("var1"))
DATA: var2=col(source(s), name("var2"))
SCALE: linear(dim(1), reverse())
GUIDE: axis(dim(1), label("var1"))
GUIDE: axis(dim(2), label("var2"))
ELEMENT: point(position(var1*var2))
END GPL.
- highlight and run that code and your graph will have a reversed axis

DocBuckets
- 262
- 1
- 8
0
In the newest version of SPSS the only code you have to enter in the syntax is reverse ()) and you paste this behing the code SCALE: linear(dim(2), so it will ook like this: SCALE: linear(dim(2), reverse ())

Mel
- 1