GPL - sorting categories on OX

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

GPL - sorting categories on OX

88videos
Hi,


my data looks similar to this

Var1 Var2 var5 var6 var7 var8
k wyż .31 .43 .14 .12
k pol .22 .43 .23 .11
k śre .21 .44 .25 .1
k zas .17 .42 .34 .06
k gim .16 .44 .29 .12
k pod .2 .41 .29 .09
k nie .19 .44 .29 .08
k bra .23 .43 .27 .07
m wyż .33 .43 .11 .13
m pol .23 .44 .2 .13
m śre .22 .44 .23 .1
m zas .18 .42 .33 .07
m gim .16 .44 .29 .12
m pod .19 .41 .31 .09
m nie .19 .43 .29 .08
m bra .23 .45 .25 .07


And I want to make 2 graphs like this.

split file by var1.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES= var2 var5 var6
var7 var8 MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
PAGE: begin(scale(900px,600px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: var5=col(source(s), name("var5"))
  DATA: var2=col(source(s), name("var2"), unit.category())
  DATA: var6=col(source(s), name("var6"))
  DATA: var7=col(source(s), name("var7"))
  DATA: var8=col(source(s), name("var8"))
GUIDE: axis(dim(1), label("Wyk"))
  GUIDE: axis(dim(2), label("% mig"))
SCALE: cat(aesthetic(aesthetic.color.interior), map(("var5",color.red),
("var6",color.blue), ("var7",color.green), ("var8",color.grey)))
   ELEMENT: line(position(var2*var5)), missing.wings(), color("var5"))
ELEMENT: point(position(var2*var5), color.interior(color.red),
shape(shape.square), transparency.exterior(transparency."1"),
 transparency.interior(transparency."0.1"), size(size."8"))
 ELEMENT: line(position(var2*var6)), missing.wings(), color("var6"))
ELEMENT: point(position(var2*var6), color.interior(color.blue),
shape(shape.square), transparency.exterior(transparency."1"),
 transparency.interior(transparency."0.1"), size(size."8"))
 ELEMENT: line(position(var2*var7))), missing.wings(), color("var7"))
ELEMENT: point(position(var2*var7), color.interior(color.green),
shape(shape.square), transparency.exterior(transparency."1"),
 transparency.interior(transparency."0.1"), size(size."8"))
 ELEMENT: line(position(var2*var8))), missing.wings(), color("var8"))
ELEMENT: point(position(var2*var8), color.interior(color.grey),
shape(shape.square), transparency.exterior(transparency."1"),
 transparency.interior(transparency."0.1"), size(size."8"))
PAGE: end()
END GPL.


I don' t know how to display on axis OX this categories (wyż, pol ...) in
original order, not alphabetical???

Thanks for help.




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

Re: GPL - sorting categories on OX

Andy W
Thank you for the (almost) reproducible example. In the future you would have
just needed to use DATA LIST to make your example data so I could copy-paste
it directly into SPSS syntax.

To do what you ask all you need is to insert the line:

SCALE: cat(dim(1), sort.data())

Anywhere inside the BEGIN GPL --- END GPL block. For consistency I would
just place it either right before or after the other SCALE statement.



-----
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 - sorting categories on OX

88videos
OK, now this works fine :) Thanks.

I will do reproducible examples.


I got other question.

Why this causes error?

data list list
/woj(A15) v1(A15) .
begin data.
'Africa' '-2.5 ; 0 tys.'
'Asia' '-2.5 ; 0 tys.'
'Australia' '2.5 ; 5 tys.'
'Europe' 'do -2.5 tys.'
'North America' 'do -2.5 tys.'
'Oceania' 'do -2.5 tys.'
'South America' 'do -2.5 tys.'
end data.
dataset name con.
dataset activate con.


DATASET ACTIVATE con.
GGRAPH
  /GRAPHDATASET NAME="graphdataset"
    VARIABLES=woj[LEVEL=nominal] v1[LEVEL=nominal]
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Polygon Overlay Map"[LOCATION=LOCAL]
    MAPPING( "color"="v1"[DATASET="graphdataset"]
"Data_Key"="woj"[DATASET="graphdataset"]))
    VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
    LABEL='POLYGON OVERLAY MAP: woj-v1'
    DEFAULTTEMPLATE=NO
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=DATA mapkey="CONTINENT"
SHOWALLFEATURES=NO]
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=REFERENCE ].


And this is ok. I assume this caused by using difficult signs like '-', ';'
at the beginning.


data list list
/woj(A25) v1(A25) .
begin data.
'Africa' 'od -2.5 do 0 tys.'
'Asia' 'od -2.5 do 0 tys.'
'Australia' 'od 2.5 do 5 tys.'
'Europe' 'do -2.5 tys.'
'North America' 'do -2.5 tys.'
'Oceania' 'do -2.5 tys.'
'South America' 'do -2.5 tys.'
end data.
dataset name con2.
dataset activate con2.


GGRAPH
  /GRAPHDATASET NAME="graphdataset"
    VARIABLES=woj[LEVEL=nominal] v1[LEVEL=nominal]
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Polygon Overlay Map"[LOCATION=LOCAL]
    MAPPING( "color"="v1"[DATASET="graphdataset"]
"Data_Key"="woj"[DATASET="graphdataset"]))
    VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
    LABEL='POLYGON OVERLAY MAP: woj-v1'
    DEFAULTTEMPLATE=NO
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=DATA mapkey="CONTINENT"
SHOWALLFEATURES=NO]
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=REFERENCE ].




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

Re: GPL - sorting categories on OX

Andy W
Yes I get an error as well, my error says
"com.spss.vis.exception.SpecificationException: At lease one row of data has
too many columns". You should file a bug report directly to SPSS.



-----
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 - sorting categories on OX

Jon Peck
In reply to this post by 88videos
If you escape the semicolons with a \, that is, replace ; with \;, then the first example works.

On Thu, Jan 18, 2018 at 2:07 AM, 88videos <[hidden email]> wrote:
OK, now this works fine :) Thanks.

I will do reproducible examples.


I got other question.

Why this causes error?

data list list
/woj(A15) v1(A15) .
begin data.
'Africa' '-2.5 ; 0 tys.'
'Asia' '-2.5 ; 0 tys.'
'Australia' '2.5 ; 5 tys.'
'Europe' 'do -2.5 tys.'
'North America' 'do -2.5 tys.'
'Oceania' 'do -2.5 tys.'
'South America' 'do -2.5 tys.'
end data.
dataset name con.
dataset activate con.


DATASET ACTIVATE con.
GGRAPH
  /GRAPHDATASET NAME="graphdataset"
    VARIABLES=woj[LEVEL=nominal] v1[LEVEL=nominal]
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Polygon Overlay Map"[LOCATION=LOCAL]
    MAPPING( "color"="v1"[DATASET="graphdataset"]
"Data_Key"="woj"[DATASET="graphdataset"]))
    VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
    LABEL='POLYGON OVERLAY MAP: woj-v1'
    DEFAULTTEMPLATE=NO
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=DATA mapkey="CONTINENT"
SHOWALLFEATURES=NO]
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=REFERENCE ].


And this is ok. I assume this caused by using difficult signs like '-', ';'
at the beginning.


data list list
/woj(A25) v1(A25) .
begin data.
'Africa' 'od -2.5 do 0 tys.'
'Asia' 'od -2.5 do 0 tys.'
'Australia' 'od 2.5 do 5 tys.'
'Europe' 'do -2.5 tys.'
'North America' 'do -2.5 tys.'
'Oceania' 'do -2.5 tys.'
'South America' 'do -2.5 tys.'
end data.
dataset name con2.
dataset activate con2.


GGRAPH
  /GRAPHDATASET NAME="graphdataset"
    VARIABLES=woj[LEVEL=nominal] v1[LEVEL=nominal]
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Polygon Overlay Map"[LOCATION=LOCAL]
    MAPPING( "color"="v1"[DATASET="graphdataset"]
"Data_Key"="woj"[DATASET="graphdataset"]))
    VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
    LABEL='POLYGON OVERLAY MAP: woj-v1'
    DEFAULTTEMPLATE=NO
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=DATA mapkey="CONTINENT"
SHOWALLFEATURES=NO]
    VIZMAP="Continents"[LOCATION=LOCAL TYPE=REFERENCE ].




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



--
Jon K Peck
[hidden email]

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