gpl question

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

gpl question

Maguin, Eugene

Here’s the gpl code.

 

GGRAPH /GRAPHDATASET NAME="graphdataset"

   VARIABLES=R.Yr1_EnrollmentMP[name="R_Yr1_EnrollmentMP"]

   FA15_Call_EmoR SP16_Call_EmoR /GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

  SOURCE: s=userSource(id("graphdataset"))

  DATA: R_Yr1_EnrollmentMP=col(source(s), name("R_Yr1_EnrollmentMP"))

  DATA: FA15_Call_EmoR=col(source(s), name("FA15_Call_EmoR"))

  DATA: SP16_Call_EmoR=col(source(s), name("SP16_Call_EmoR"))

  GUIDE: axis(dim(1), label("R.Yr1_EnrollmentMP"))

  GUIDE: axis(dim(2), label("Call_EmoR"))

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR)))

  ELEMENT: line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR))))

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR)))

  ELEMENT: line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR))))

END GPL.

 

What I want to do is to have the FA15 points and line be one color and the SP16 points and line be another color.

For some reason, the processor won’t accept, for instance, color(color.<red>) . It seems to want some algebra. I’ve seen the example where a ‘by’ variable is used to define color but the data set is a wide format and I’m not interested in rolling it over to a long format. So, could there be a way to do what I want?

 

Thanks, Gene Maguin

===================== 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: gpl question

Andy W
Untested (if you provide an example dataset I will test it tomorrow), but you
should be able to do "color.interior(color.red)" etc. to do what you want (I
can never remember if lines only have interior fills or exterior, so if
interior for lines gives an error do the other one). So something like:

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR)),
color.interior(color.red))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR))),
color.interior(color.red))
  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR)),
color.interior(color.blue))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR))),
color.interior(color.blue))

If you want a legend, I believe you can map the aesthetics to an arbitrary
string, like so:

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR)),
color.interior("Group 1"))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR))),
color.interior("Group 1"))
  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR)),
color.interior("Group 2"))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR))),
color.interior("Group 2"))

And then if you want Group 1 or Group 2 in the above example to be specific
colors, then you would add a line like:

SCALE: cat(aesthetic(aesthetic.color.interior), map(("Group
1",color.red),("Group 2",color.blue)))



-----
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: gpl question

Maguin, Eugene
Andy,
It worked. Thank you. I never would have figured it out. The notion that a line or a dot has an "interior" is not meaningful (although I admit/agree that my dots look to have a black perimeter line and a red or blue "interior".
Gene Maguin

-----Original Message-----
From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Andy W
Sent: Tuesday, October 23, 2018 7:56 PM
To: [hidden email]
Subject: Re: gpl question

Untested (if you provide an example dataset I will test it tomorrow), but you should be able to do "color.interior(color.red)" etc. to do what you want (I can never remember if lines only have interior fills or exterior, so if interior for lines gives an error do the other one). So something like:

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR)),
color.interior(color.red))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR))),
color.interior(color.red))
  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR)),
color.interior(color.blue))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR))),
color.interior(color.blue))

If you want a legend, I believe you can map the aesthetics to an arbitrary string, like so:

  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR)),
color.interior("Group 1"))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*FA15_Call_EmoR))),
color.interior("Group 1"))
  ELEMENT: point(position(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR)),
color.interior("Group 2"))
  ELEMENT:
line(position(smooth.quadratic(summary.mean(R_Yr1_EnrollmentMP*SP16_Call_EmoR))),
color.interior("Group 2"))

And then if you want Group 1 or Group 2 in the above example to be specific colors, then you would add a line like:

SCALE: cat(aesthetic(aesthetic.color.interior), map(("Group 1",color.red),("Group 2",color.blue)))



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