Sorting Categories in a bar chart

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

Sorting Categories in a bar chart

aschoff
Hi,

i have a bar chart which depicts the ratings of a number of raters. In one
chart the single raters are the categories on the x-axis. To visualize
something I would like to sort these raters by another variable (i.e.
received payment). Is there any way to sort the bar chart categories
depending on another variable in the data set (except doing it manually)?

Thanks a lot,
Robinson
----------------------------------------------------------------
Felix-Robinson Aschoff
Information Management Research Group
Department of Informatics
University of Zurich
Binzmuehlestrasse 14
CH-8050 Zurich, Switzerland

E-Mail: [hidden email]
Phone: +41 (0)44 635 6690
Fax: +41 (0)44 635 6809
Room: 2.D.11
http://www.ifi.uzh.ch/im

=====================
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: Sorting Categories in a bar chart

ViAnn Beadle
Using GPL you can sort by any of the usual statistics applied to a
non-categorical number. Here's an example using the employee data.sav sample
data file in which job categories are sorted by the mean of years of
education and the height of the bars is determined by the mean current
salary:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat salary educ
    MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: jobcat=col(source(s), name("jobcat"), unit.category())
  DATA: salary=col(source(s), name("salary"))
  DATA: educ=col(source(s), name("educ"))
  GUIDE: axis(dim(1), label("Job Category"))
  GUIDE: axis(dim(2), label("Mean Current Salary"))
  SCALE: cat(dim(1), sort.statistic(summary.mean(educ)))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(summary.mean(jobcat*salary)),
shape.interior(shape.square))
END GPL.

Notes:
All the aggregations are done within the GPL and not by the GGRAPH command.
You'll need to specify the variable for the x axis, the y axis if a variable
is used there, and the sorting variable in the GGRAPH command and in a DATA
statement within the GPL.
The sort.statistic function is used on SCALE statement to define the order
for x-axis which is dimension 1.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
[hidden email]
Sent: Wednesday, November 26, 2008 4:58 AM
To: [hidden email]
Subject: Sorting Categories in a bar chart

Hi,

i have a bar chart which depicts the ratings of a number of raters. In one
chart the single raters are the categories on the x-axis. To visualize
something I would like to sort these raters by another variable (i.e.
received payment). Is there any way to sort the bar chart categories
depending on another variable in the data set (except doing it manually)?

Thanks a lot,
Robinson
----------------------------------------------------------------
Felix-Robinson Aschoff
Information Management Research Group
Department of Informatics
University of Zurich
Binzmuehlestrasse 14
CH-8050 Zurich, Switzerland

E-Mail: [hidden email]
Phone: +41 (0)44 635 6690
Fax: +41 (0)44 635 6809
Room: 2.D.11
http://www.ifi.uzh.ch/im

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