gpl problem with questions

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

gpl problem with questions

Maguin, Eugene

The outcome is a APA style formatted figure with the legend inside the frame or perimeter of the plot.

My brief and not-so happy experience with GPL is that the legend is placed outside the frame/perimeter and, if controllable, I don’t know how to do it. And, the syntax below generates two legends. I think that I could remove the ‘point’ element and get rid of the second legend but I would like to keep the identified points since the data are collected at discrete points in time. That’s less important than the legend problem.

 

What I’m running right now is this.

 

GGRAPH /GRAPHDATASET NAME="GraphDataset" VARIABLES=time cig6_r FRADST/

   GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

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

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

DATA: cig6_r=col(source(s), name("cig6_r"), unit.category())

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

GUIDE: axis(dim(1), label("Assessment Time Point (Yrs)"), start(0), delta(.5))

GUIDE: axis(dim(2), label("Mean Depression Total Score Percentile"),

   start(48), delta(2))

SCALE: linear(dim(2), min(48), max(58))

ELEMENT: point(position(summary.mean(time*FRADST)), shape(cig6_r))

ELEMENT: line(position(summary.mean(time*FRADST)), shape(cig6_r))

END GPL.

 

Thanks, Gene Maguin

 

 

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: gpl problem with questions

Andy W
The legend position is not controllable though inline GPL - only through the chart template. You can post hoc edit the chart and save the template to control where the legend is located. (I would personally like it if you could control it like you can in R, by specifying particular anchors or xy coordinates - theoretically input would be the same as for a "form.line" guide type using a position statement.)

I'm not sure off-hand if you will be able to get rid of the different shapes for the legend. You could get rid of the entire legend by using:

  GUIDE: legend(aesthetic(aesthetic.shape.interior), null())

But since both the points and the lines map to a "shape.interior" I'm not sure how SPSS would distinguish between the two - although it would be nice if SPSS auto-recognized they are mapped to the same elements and combined them.

Other alternatives are to use color or small multiples. Line dashes don't tend to look very good with points, so color is preferable if at all possible. (Sometimes interpolating points over the range of the X axis looks better than using particular dash patterns for lines.)
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/