Scatterplot Matrix Customization

classic Classic list List threaded Threaded
3 messages Options
JSB
Reply | Threaded
Open this post in threaded view
|

Scatterplot Matrix Customization

JSB
When plotting matrix scatterplots, is there any way to limit the plotted relationships? The data below produces 6x6 matrix. Instead, I'm trying to produce a 3x3 (X1, X2, X3 vs Y1, Y2, Y3) since the rest of the relationships are not of interest and produce confusion when data is presented.



DATA LIST LIST
/ X1    X2    X3    Y1    Y2    Y3.
BEGIN DATA
156.31    162.75    165.85    190.65    145.54    154.22
195.78    198.56    163.68    220.95    234.70    217.76
174.78    136.55    135.78    123.72    123.94    131.07
161.40    166.34    140.11    160.85    173.27    158.47
145.32    160.12    145.90    94.29     101.89     93.31
148.79    137.22    130.89    77.19      75.62      70.97
175.45    165.07    152.58    190.43    196.74     231.39
198.79    189.85    175.69    96.25      133.91    131.75
185.80    189.45    172.02    131.53    150.33    130.97
196.29    195.72    164.76    160.36    135.77    136.23
END DATA.
 
 
  GRAPH
  /SCATTERPLOT(MATRIX)=X1 X2 X3 Y1 Y2 Y3
  /MISSING=LISTWISE.

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Scatterplot Matrix Customization

Andy W
If instead of doing the legacy dialog, you use the Chart Builder GUI and do a
scatterplot matrix and paste the code you will get:

***************************************************.
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X1 X2 X3 Y1 Y2 Y3
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: X1=col(source(s), name("X1"))
  DATA: X2=col(source(s), name("X2"))
  DATA: X3=col(source(s), name("X3"))
  DATA: Y1=col(source(s), name("Y1"))
  DATA: Y2=col(source(s), name("Y2"))
  DATA: Y3=col(source(s), name("Y3"))
  GUIDE: axis(dim(1.1), ticks(null()))
  GUIDE: axis(dim(2.1), ticks(null()))
  GUIDE: axis(dim(1), gap(0px))
  GUIDE: axis(dim(2), gap(0px))
  GUIDE: text.title(label("Scatterplot Matrix X1,X2,X3..."))
  TRANS: X1_label = eval("X1")
  TRANS: X2_label = eval("X2")
  TRANS: X3_label = eval("X3")
  TRANS: Y1_label = eval("Y1")
  TRANS: Y2_label = eval("Y2")
  TRANS: Y3_label = eval("Y3")
  ELEMENT:
point(position((X1/X1_label+X2/X2_label+X3/X3_label+Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)*
   
(X1/X1_label+X2/X2_label+X3/X3_label+Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)))
END GPL.
***************************************************.

Now in the ELEMENT line you just need to edit it to only produce the cross
relationships you want:

***************************************************.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X1 X2 X3 Y1 Y2 Y3
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: X1=col(source(s), name("X1"))
  DATA: X2=col(source(s), name("X2"))
  DATA: X3=col(source(s), name("X3"))
  DATA: Y1=col(source(s), name("Y1"))
  DATA: Y2=col(source(s), name("Y2"))
  DATA: Y3=col(source(s), name("Y3"))
  GUIDE: axis(dim(1.1), ticks(null()))
  GUIDE: axis(dim(2.1), ticks(null()))
  GUIDE: axis(dim(1), gap(0px))
  GUIDE: axis(dim(2), gap(0px))
  GUIDE: text.title(label("Scatterplot Matrix X1,X2,X3..."))
  TRANS: X1_label = eval("X1")
  TRANS: X2_label = eval("X2")
  TRANS: X3_label = eval("X3")
  TRANS: Y1_label = eval("Y1")
  TRANS: Y2_label = eval("Y2")
  TRANS: Y3_label = eval("Y3")
  ELEMENT:
point(position((X1/X1_label+X2/X2_label+X3/X3_label)*(Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)))
END GPL.
***************************************************.

That produces your 3x3 matrix of plots you want.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
JSB
Reply | Threaded
Open this post in threaded view
|

Re: Scatterplot Matrix Customization

JSB
Thanks Andy. I had missed out on this option in the Chart Builder.

On Wed, Oct 11, 2017 at 7:50 AM, Andy W <[hidden email]> wrote:
If instead of doing the legacy dialog, you use the Chart Builder GUI and do a
scatterplot matrix and paste the code you will get:

***************************************************.
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X1 X2 X3 Y1 Y2 Y3
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: X1=col(source(s), name("X1"))
  DATA: X2=col(source(s), name("X2"))
  DATA: X3=col(source(s), name("X3"))
  DATA: Y1=col(source(s), name("Y1"))
  DATA: Y2=col(source(s), name("Y2"))
  DATA: Y3=col(source(s), name("Y3"))
  GUIDE: axis(dim(1.1), ticks(null()))
  GUIDE: axis(dim(2.1), ticks(null()))
  GUIDE: axis(dim(1), gap(0px))
  GUIDE: axis(dim(2), gap(0px))
  GUIDE: text.title(label("Scatterplot Matrix X1,X2,X3..."))
  TRANS: X1_label = eval("X1")
  TRANS: X2_label = eval("X2")
  TRANS: X3_label = eval("X3")
  TRANS: Y1_label = eval("Y1")
  TRANS: Y2_label = eval("Y2")
  TRANS: Y3_label = eval("Y3")
  ELEMENT:
point(position((X1/X1_label+X2/X2_label+X3/X3_label+Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)*

(X1/X1_label+X2/X2_label+X3/X3_label+Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)))
END GPL.
***************************************************.

Now in the ELEMENT line you just need to edit it to only produce the cross
relationships you want:

***************************************************.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=X1 X2 X3 Y1 Y2 Y3
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: X1=col(source(s), name("X1"))
  DATA: X2=col(source(s), name("X2"))
  DATA: X3=col(source(s), name("X3"))
  DATA: Y1=col(source(s), name("Y1"))
  DATA: Y2=col(source(s), name("Y2"))
  DATA: Y3=col(source(s), name("Y3"))
  GUIDE: axis(dim(1.1), ticks(null()))
  GUIDE: axis(dim(2.1), ticks(null()))
  GUIDE: axis(dim(1), gap(0px))
  GUIDE: axis(dim(2), gap(0px))
  GUIDE: text.title(label("Scatterplot Matrix X1,X2,X3..."))
  TRANS: X1_label = eval("X1")
  TRANS: X2_label = eval("X2")
  TRANS: X3_label = eval("X3")
  TRANS: Y1_label = eval("Y1")
  TRANS: Y2_label = eval("Y2")
  TRANS: Y3_label = eval("Y3")
  ELEMENT:
point(position((X1/X1_label+X2/X2_label+X3/X3_label)*(Y1/Y1_label+Y2/Y2_label+Y3/Y3_label)))
END GPL.
***************************************************.

That produces your 3x3 matrix of plots you want.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD