BoxPlot with point

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

BoxPlot with point

Garry Gelade
Dear all

I am just getting my head round GPL. What I want to do is create a boxplot
overlaid with a single dot at a specified position. I used the following
based on one of John Peck's posts.


COMPUTE Target = 0.5.  /* Suppose I want the dot at 0.5*/

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Shooting.ACC[name="Skill"]
Target[name="X"] PlayerID
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: X=col(source(s), name("X"))
DATA: Skill=col(source(s), name("Skill"))
DATA: id=col(source(s), name("PlayerID"), unit.category())
COORD: rect(dim(1), transpose())
GUIDE: axis(dim(1), label("Accuracy"))
ELEMENT: schema(position(bin.quantile.letter(Skill)), label(id))
ELEMENT: point( position(summary.mean(X)), shape(shape.circle),
label("Joe"), color(color.red) )
END GPL.

This works, but I wonder if it is possible to do it without first computing
a column in the source dataset. Is there a way to insert a fixed value
directly into the GPL somewhere?

Regards
Garry Gelade

=====================
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: BoxPlot with point

ViAnn Beadle
In this case you have a single dimension so setting that value is fairly
easy with a TRANS statement with the eval function. Here's an example using
the cars.sav sample dataset:

* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=horse MISSING=LISTWISE
REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: horse=col(source(s), name("horse"))
  TRANS: x=eval(150)
  DATA: id=col(source(s), name("$CASENUM"), unit.category())
  COORD: rect(dim(1))
  GUIDE: axis(dim(1), label("Horsepower"))
  ELEMENT: schema(position(bin.quantile.letter(horse)), label(id))
  ELEMENT: point(position(x), color(color.red))
END GPL.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Garry Gelade
Sent: Thursday, August 21, 2008 1:51 PM
To: [hidden email]
Subject: BoxPlot with point

Dear all

I am just getting my head round GPL. What I want to do is create a boxplot
overlaid with a single dot at a specified position. I used the following
based on one of John Peck's posts.


COMPUTE Target = 0.5.  /* Suppose I want the dot at 0.5*/

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Shooting.ACC[name="Skill"]
Target[name="X"] PlayerID
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: X=col(source(s), name("X"))
DATA: Skill=col(source(s), name("Skill"))
DATA: id=col(source(s), name("PlayerID"), unit.category())
COORD: rect(dim(1), transpose())
GUIDE: axis(dim(1), label("Accuracy"))
ELEMENT: schema(position(bin.quantile.letter(Skill)), label(id))
ELEMENT: point( position(summary.mean(X)), shape(shape.circle),
label("Joe"), color(color.red) )
END GPL.

This works, but I wonder if it is possible to do it without first computing
a column in the source dataset. Is there a way to insert a fixed value
directly into the GPL somewhere?

Regards
Garry Gelade

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

Re: BoxPlot with point

Garry Gelade
 Thanks Viann!!

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
ViAnn Beadle
Sent: 21 August 2008 22:09
To: [hidden email]
Subject: Re: BoxPlot with point

In this case you have a single dimension so setting that value is fairly
easy with a TRANS statement with the eval function. Here's an example using
the cars.sav sample dataset:

* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=horse MISSING=LISTWISE
REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: horse=col(source(s), name("horse"))
  TRANS: x=eval(150)
  DATA: id=col(source(s), name("$CASENUM"), unit.category())
  COORD: rect(dim(1))
  GUIDE: axis(dim(1), label("Horsepower"))
  ELEMENT: schema(position(bin.quantile.letter(horse)), label(id))
  ELEMENT: point(position(x), color(color.red)) END GPL.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Garry Gelade
Sent: Thursday, August 21, 2008 1:51 PM
To: [hidden email]
Subject: BoxPlot with point

Dear all

I am just getting my head round GPL. What I want to do is create a boxplot
overlaid with a single dot at a specified position. I used the following
based on one of John Peck's posts.


COMPUTE Target = 0.5.  /* Suppose I want the dot at 0.5*/

GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Shooting.ACC[name="Skill"]
Target[name="X"] PlayerID
MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: X=col(source(s), name("X"))
DATA: Skill=col(source(s), name("Skill"))
DATA: id=col(source(s), name("PlayerID"), unit.category())
COORD: rect(dim(1), transpose())
GUIDE: axis(dim(1), label("Accuracy"))
ELEMENT: schema(position(bin.quantile.letter(Skill)), label(id))
ELEMENT: point( position(summary.mean(X)), shape(shape.circle),
label("Joe"), color(color.red) ) END GPL.

This works, but I wonder if it is possible to do it without first computing
a column in the source dataset. Is there a way to insert a fixed value
directly into the GPL somewhere?

Regards
Garry Gelade

=====================
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

__________ NOD32 3376 (20080821) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.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