gpl formatting

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

gpl formatting

ViAnn Beadle

GPL and ggplot2 are specification implementations of Lee Wilkinson’s Grammar of Graphics. A chart template defines the aesthetics of the graph including colors, sizes, layout, etc. vizML is an internal specification of a graph. It contains much more information about the. BTW, Graphboard is yet another graphing option within Statistics,  based only upon vizML,  which is an entirely separate discussion.

 

GPL + “chart template” à vizML àrendered chart

 

To change aesthetics for all charts coming from BEGIN GPL you have the following options:

 

1)      Change default colors for data elements, basic text, and size via Edit>Options>Chart.

2)      Clone and edit the default template applied to the chart which is stored in template\chart_style.sgt in the SPSS install space. Then use SET CTEMPLATE to refer to it.

3)      Edit a chart in the chart editor and save the template. Then refer to that template via the TEMPLATE keyword on the GGRAPH GRAPHSPEC subcommand. You can apply multiple templates to a chart.  If you search through the archives, you’ll see that YMMV with this approach.

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-Jan Roskam
Sent: Friday, June 08, 2012 5:29 AM
To: [hidden email]
Subject: Re: gpl question

 

Can I squeeze in some general GPL questions? Are GPL, ViZml and ggplot2 three implementations of the Grammar of Graphics? Or is GPL code stored internally in an xml representation called ViZml? I find the defaults of ggplot2 visually very pleasing. Is it possible to change those defaults in GPL once and for all and make them similar to those of ggplot2?

 

Regards,
Albert-Jan

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

From: ViAnn Beadle <[hidden email]>
To: [hidden email]
Sent: Friday, June 8, 2012 3:02 AM
Subject: Re: [SPSSX-L] gpl question


I assume that your six variables have the same scale.

If you are comparing variables, it's going to be a lot easier if you use
VARSTOCASES first to create one variable with six times as many cases as
variables.
As long as you have the same X and Y axes, you can overlay multiple elements
in it. I usually start with Chart Builder and design a chart that has no
summary statistic by specifying the "Value" statistic. This just passes a
nice un-aggregated matrix of data to the generator and  I use functions (in
this instance, summary.mean) within GPL to summarize data such as group
means.

Here's an example:

*Gen up some data first.
input program.
loop #i = 1 to 20.
do repeat vars=var1 to var6.
compute vars = RV.NORMAL(0,1).
end repeat.
compute groups=RND(RV.UNIFORM(0,1)).
end case.
end loop.
end file.
end input program.
* Restructure.
VARSTOCASES
  /MAKE Values FROM var1 var2 var3 var4 var5 var6
  /INDEX=Variables(6)
  /KEEP=groups
  /NULL=KEEP.

VALUE LABELS Variables 1 "Var1" 2 "Var2" 3 "Var3" 4 "Var4" 5 "Var5" 6
"Var6".

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Variables Values groups
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Variables=col(source(s), name("Variables"), unit.category())
  DATA: Values=col(source(s), name("Values"))
  DATA: groups=col(source(s), name("groups"), unit.category())
  GUIDE: axis(dim(1), label("Variables"))
  GUIDE: axis(dim(2), label("Values"))
  GUIDE: legend(aesthetic(aesthetic.color.exterior), label("groups"))
  SCALE: cat(dim(1), include("1", "2", "3", "4", "5", "6"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(region.spread.range(Variables*Values))),
    shape(shape.square))
  ELEMENT: point(position(summary.mean(Variables*Values)), color(groups))
  ELEMENT: point(position(summary.mean(Variables*Values)), color("Pop
Mean"))
END GPL.

Notes:
Elements are drawn in the order they used so that the interval element is
drawn first, then the points for the subgroup means, and finally a point for
Population Mean.
When the aesthetic (in this instance, color) is assigned to a categorical
variable, a point distinguished by color is generated for each value of the
categorical variable.
When the aesthetic is given a constant, there are no subgroups and a single
point is displayed. The text of the constant is displayed in the legend.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Maguin, Eugene
Sent: Thursday, June 07, 2012 3:53 PM
To: [hidden email]
Subject: gpl question

I have what might or might not be a complex graph to do. On one graph, I'd
like to show the ranges for six variables, a bar or line to indicate the
mean of the variable and a dot or point to indicate how a specific group
scored on each of the variables. So you look at the chart and see for group
A its mean and score range for variable X and a dot showing the group B mean
on that variable. Nicely compact!

I've reading over the GPL manual and see how to do a range and I figure that
a line isn't too hard and a dot might not be either provided the data are
structured right, which is kind of a question. But that's not THE question.

The question is putting multiple variables on the same plot. There is a
faceted example and a clustered example but neither is quite what I have in
mind, I don't think. How is that done?

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

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