Hi yall,
I just want to change the orientation of the pies from a columnwise (as now) to a rowwise orientation. Can SPSS do that? My sample code works for v20. Thank you, TinyTina get file="C:\...English\Employee data.sav". GGRAPH /GRAPHDATASET NAME="Employeedata" VARIABLES=all MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Employeedata")) DATA: jobcat = col(source(s), name("jobcat"), unit.category()) DATA: gender = col(source(s), name("gender"), unit.category()) COORD: polar.theta() SCALE: linear(dim(1), dataMinimum(), dataMaximum()) GUIDE: axis(dim(1), null()) GUIDE: axis(dim(2), label("Job Category")) ELEMENT: interval.stack(position(summary.percent.count(1*jobcat)),color(gender)) END GPL. ===================== 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 |
This will stack the pies vertically
GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat gender COUNT()[name="COUNT"] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: gender=col(source(s), name("gender"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) COORD: polar.theta(startAngle(0)) GUIDE: axis(dim(1), null()) GUIDE: axis(dim(3), label("Employment Category"), opposite()) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Gender")) SCALE: linear(dim(1), dataMinimum(), dataMaximum()) SCALE: cat(dim(3), include("1", "2", "3")) ELEMENT: interval.stack(position(summary.percent(COUNT*1*jobcat))), color.interior(gender)) END GPL. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: SUBSCRIBE SPSSX-L Anonymous <[hidden email]> To: [hidden email] Date: 05/23/2012 04:11 AM Subject: [SPSSX-L] BEGIN GPL question: From columnwise to rowwise orientation Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi yall, I just want to change the orientation of the pies from a columnwise (as now) to a rowwise orientation. Can SPSS do that? My sample code works for v20. Thank you, TinyTina get file="C:\...English\Employee data.sav". GGRAPH /GRAPHDATASET NAME="Employeedata" VARIABLES=all MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Employeedata")) DATA: jobcat = col(source(s), name("jobcat"), unit.category()) DATA: gender = col(source(s), name("gender"), unit.category()) COORD: polar.theta() SCALE: linear(dim(1), dataMinimum(), dataMaximum()) GUIDE: axis(dim(1), null()) GUIDE: axis(dim(2), label("Job Category")) ELEMENT: interval.stack(position(summary.percent.count(1*jobcat)),color(gender)) END GPL. ===================== 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,
This is nice, however, now the labels are vertical, not horizontal. Any idea how to turn them? Is there a ROTATE or ANGEE option valid also for the alignment of labels? Thanks , TinyTina 2012/5/23 Jon K Peck <[hidden email]> This will stack the pies vertically |
After aligning the labels even saving all attributes in the template doesnt change it in newly generated graphs.
2012/5/23 Jon K Peck <[hidden email]> There isn't an option in GPL for this, but try creating one chart, editing it in the Chart Editor and changing the label orientation as needed. Then save it as a template, selecting only the appropriate properties, and reference that template in the other charts where you need this. |
Maybe the GraphBoard equivalent would work
better for you.
Here is the syntax generated from Graphs>GraphBoard Template Chooser using the Detailed tab. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=gender[LEVEL=nominal] jobcat[LEVEL=ordinal] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="Pie of Counts"[LOCATION=LOCAL] MAPPING( "categories"="gender"[DATASET="graphdataset"] "Panel "+ "down"="jobcat"[DATASET="graphdataset"] "Summary"="count")) VIZSTYLESHEET="Traditional"[LOCATION=LOCAL] LABEL='PIE OF COUNTS: gender' DEFAULTTEMPLATE=NO. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Gimme More <[hidden email]> To: [hidden email] Date: 05/24/2012 01:20 AM Subject: Re: [SPSSX-L] BEGIN GPL question: From columnwise to rowwise orientation Sent by: "SPSSX(r) Discussion" <[hidden email]> After aligning the labels even saving all attributes in the template doesnt change it in newly generated graphs. 2012/5/23 Jon K Peck <peck@...> There isn't an option in GPL for this, but try creating one chart, editing it in the Chart Editor and changing the label orientation as needed. Then save it as a template, selecting only the appropriate properties, and reference that template in the other charts where you need this. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM peck@... new phone: <a href="tel:720-342-5621" target=_blank>720-342-5621 From: Gimme More <gimmemore69s@...> To: [hidden email] Date: 05/23/2012 02:42 PM Subject: Re: [SPSSX-L] BEGIN GPL question: From columnwise to rowwise orientation Sent by: "SPSSX(r) Discussion" <[hidden email]> Jon, This is nice, however, now the labels are vertical, not horizontal. Any idea how to turn them? Is there a ROTATE or ANGEE option valid also for the alignment of labels? Thanks , TinyTina 2012/5/23 Jon K Peck <peck@...> This will stack the pies vertically GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat gender COUNT()[name="COUNT"] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: gender=col(source(s), name("gender"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) COORD: polar.theta(startAngle(0)) GUIDE: axis(dim(1), null()) GUIDE: axis(dim(3), label("Employment Category"), opposite()) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Gender")) SCALE: linear(dim(1), dataMinimum(), dataMaximum()) SCALE: cat(dim(3), include("1", "2", "3")) ELEMENT: interval.stack(position(summary.percent(COUNT*1*jobcat))), color.interior(gender)) END GPL. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM peck@... new phone: <a href="tel:720-342-5621" target=_blank>720-342-5621 From: SUBSCRIBE SPSSX-L Anonymous <gimmemore69s@...> To: [hidden email] Date: 05/23/2012 04:11 AM Subject: [SPSSX-L] BEGIN GPL question: From columnwise to rowwise orientation Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi yall, I just want to change the orientation of the pies from a columnwise (as now) to a rowwise orientation. Can SPSS do that? My sample code works for v20. Thank you, TinyTina get file="C:\...English\Employee data.sav". GGRAPH /GRAPHDATASET NAME="Employeedata" VARIABLES=all MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s = userSource(id("Employeedata")) DATA: jobcat = col(source(s), name("jobcat"), unit.category()) DATA: gender = col(source(s), name("gender"), unit.category()) COORD: polar.theta() SCALE: linear(dim(1), dataMinimum(), dataMaximum()) GUIDE: axis(dim(1), null()) GUIDE: axis(dim(2), label("Job Category")) ELEMENT: interval.stack(position(summary.percent.count(1*jobcat)),color(gender)) END GPL. ===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (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 |
Free forum by Nabble | Edit this page |