Quadrant Lines

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

Quadrant Lines

zstatman
Producing a simple scatter graph with following syntax but would like to make
it less specific as to where the quadrant lines go, now fixed at 6.77 on
x-axis and .896 on the y):

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Satisfaction recom var1
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Satisfaction=col(source(s), name("Satisfaction"))
  DATA: recom=col(source(s), name("recom"))
  DATA: var1=col(source(s), name("var1"), unit.category())
  GUIDE: axis(dim(1), label("Level of Satisfaction with Company
(Attributes)"))
  GUIDE: axis(dim(2), label("Would you Recommend the Company
(Correlation)"))
  GUIDE: form.line(position(6.77), color(color.black))
  GUIDE: form.line(position(*, .896), color(color.black))
  ELEMENT: point(position(Satisfaction*recom), label(var1))
END GPL.

Let me know if need more, sure it's a simple "ELEMENT: line(position
........." addition but ...




-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
Skype & Google Talk: zstatman
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
You would think at least 1 person would have a comment!!!!



-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

Andy W
You need to be more explicit as to what the problem is with simply changing

GUIDE: form.line(position(*, .896), color(color.black))

to whatever value you need for the Y axis. Ditto for the X axis.



-----
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/
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
Thanks Andy .... The lines

 GUIDE: form.line(position(6.77), color(color.black))
 GUIDE: form.line(position(*, .896), color(color.black))

Create a specific mean vertical and horizontal set of lines but would like
to change this, if possible, to "read" the data then auto create these
lines. Thus, the GPL would create the lines across multiple scratters versus
me having to do so for each one............... Clearer?

I think this is done using the  "ELEMENT: line(position  ...." function but
can't get it to work or don't know how, etc





-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

Andy W
Much clearer - thank you. Here is one way to do it by adding in two mean
variables into the dataset.

************************************************************************************.
DATA LIST FREE / Satisfaction recom.
BEGIN DATA
1 5
2 4
3 3
4 2
5 1
END DATA.
DATASET NAME Examp.
STRING var1 (A2).
COMPUTE var1 = CONCAT("A",STRING(recom,F1.0)).
EXECUTE.


*Original.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Satisfaction recom var1
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Satisfaction=col(source(s), name("Satisfaction"))
  DATA: recom=col(source(s), name("recom"))
  DATA: var1=col(source(s), name("var1"), unit.category())
  GUIDE: axis(dim(1), label("Level of Satisfaction with Company
(Attributes)"))
  GUIDE: axis(dim(2), label("Would you Recommend the Company
(Correlation)"))
  GUIDE: form.line(position(6.77), color(color.black))
  GUIDE: form.line(position(*, .896), color(color.black))
  ELEMENT: point(position(Satisfaction*recom), label(var1))
END GPL.

*Adding in mean line according to data.
AGGREGATE OUTFILE=* MODE=ADDVARIABLES
  /BREAK
  /MeanSat = MEAN(Satisfaction)
  /MeanRec = MEAN(recom).

*With lines set at the means.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Satisfaction recom var1
MeanSat MeanRec
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Satisfaction=col(source(s), name("Satisfaction"))
  DATA: recom=col(source(s), name("recom"))
  DATA: MeanSat=col(source(s), name("MeanSat"))
  DATA: MeanRec=col(source(s), name("MeanRec"))
  DATA: var1=col(source(s), name("var1"), unit.category())
  GUIDE: axis(dim(1), label("Level of Satisfaction with Company
(Attributes)"))
  GUIDE: axis(dim(2), label("Would you Recommend the Company
(Correlation)"))
  ELEMENT: path(position(Satisfaction*MeanRec))
  ELEMENT: path(position(MeanSat*recom))
  ELEMENT: point(position(Satisfaction*recom), label(var1))
END GPL.
************************************************************************************.

There is another way to do it directly within GGRAPH without adding in extra
variables into the dataset, but I think this approach is easier.



-----
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/
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
That's it Andy, thanks for the help; and to Jon for some offline advice

Also, Andy, might add this to your Web page, it got me started.

Will



-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
Andy, another question: Is there a way to get the quadrant lines to extend
from axis to axis?

Tks again
W



-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
Never mind Andy, looking further into the code see that can't, unless missing
something

W



-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

Andy W
If you mean extending the lines to the edge of the plot, here is a way using
a similar logic. You need to set the SCALE limits though, as SPSS's
auto-figure it out will expand beyond the data.

************************************************************************************.
DATA LIST FREE / Satisfaction recom.
BEGIN DATA
1 5
2 4
3 3
4 2
5 1
END DATA.
DATASET NAME Examp.
STRING var1 (A2).
COMPUTE var1 = CONCAT("A",STRING(recom,F1.0)).
EXECUTE.
*Making lines extend beyond the data.
DATASET DECLARE QuadLines.
AGGREGATE OUTFILE='QuadLines'
  /BREAK
  /MeanSat = MEAN(Satisfaction)
  /MeanRec = MEAN(recom)
  /MinX = MIN(Satisfaction)
  /MaxX = MAX(Satisfaction)
  /MinY = MIN(recom)
  /MaxY = MAX(recom).
DATASET ACTIVATE QuadLines.
*Extending min/max beyond the data by a constant amount.
DO REPEAT MinV = MinX MinY
           /MaxV = MaxX MaxY.
  COMPUTE MinV = MinV*-1.5.
  COMPUTE MaxV = MaxV*1.5.
END REPEAT.
*Need additional rules if numbers are negative.
EXECUTE.


*With lines set at the means.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" DATASET="Examp" VARIABLES=Satisfaction
recom var1
                 MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHDATASET NAME="lines" DATASET="QuadLines" VARIABLES=MeanSat MeanRec
MinX MinY MaxX MaxY
  /GRAPHSPEC SOURCE=INLINE
  /FITLINE TOTAL=NO.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Satisfaction=col(source(s), name("Satisfaction"))
  DATA: recom=col(source(s), name("recom"))
  DATA: var1=col(source(s), name("var1"), unit.category())
  SOURCE: l=userSource(id("lines"))
  DATA: MeanSat=col(source(l), name("MeanSat"))
  DATA: MeanRec=col(source(l), name("MeanRec"))
  DATA: MinX=col(source(l), name("MinX"))
  DATA: MaxX=col(source(l), name("MaxX"))
  DATA: MinY=col(source(l), name("MinY"))
  DATA: MaxY=col(source(l), name("MaxY"))      
  GUIDE: axis(dim(1), label("Level of Satisfaction with Company
(Attributes)"))
  GUIDE: axis(dim(2), label("Would you Recommend the Company
(Correlation)"))
  SCALE: linear(dim(1), min(1), max(5))
  SCALE: linear(dim(2), min(1), max(5))  
  ELEMENT: edge(position((MinX+MaxX)*MeanRec)))
  ELEMENT: edge(position(MeanSat*(MinY+MaxY)))
  ELEMENT: point(position(Satisfaction*recom), label(var1))
END GPL.
************************************************************************************.



-----
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/
Reply | Threaded
Open this post in threaded view
|

Re: Quadrant Lines

zstatman
Thanks Andy, this is getting interesting and very helpful

W



-----
Will
Statistical Services
 
============
[hidden email]
http://home.earthlink.net/~z_statman/
============
--
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
Will
Statistical Services
 
============
info.statman@earthlink.net
http://home.earthlink.net/~z_statman/
============