|
I am running the following
* Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=Q8a COUNT()[name="COUNT"] DataSet MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: Q8a=col(source(s), name("Q8a"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: DataSet=col(source(s), name("DataSet"), unit.category()) COORD: rect(dim(1,2), cluster(3,0)) GUIDE: axis(dim(3), label("Context meet Mentor1")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Data Set")) SCALE: cat(dim(3), include("1", "2", "3", "4")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("1", "2", "3", "4")) SCALE: cat(dim(1), include("1", "2", "3", "4")) ELEMENT: interval(position(summary.percent(DataSet*COUNT*Q8a, base.aesthetic(aesthetic(aesthetic.color.interior)))), color.interio r(DataSet), shape.interior(shape.square)) END GPL. The bars heights are fine [as a % compared the total for each Legend (fill color)] but when I apply the labels via Chart Editor the counts are right but the % remains against the total case count instead of the Legend base. Why, and is there a way to change that? I am running V16.0.2. Hope this is clear. Tks, WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ ===================== 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
Will
Statistical Services ============ info.statman@earthlink.net http://home.earthlink.net/~z_statman/ ============ |
|
You can specify the percent label directly within the GPL itself using the
label function. Here is an example using the Employee Data.sav sample file to create both a count and percent label in the bars: GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=minority COUNT()[name="COUNT"] gender MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: minority=col(source(s), name("minority"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: gender=col(source(s), name("gender"), unit.category()) COORD: rect(dim(1,2), cluster(3,0)) GUIDE: axis(dim(3), label("Minority Classification")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Gender")) SCALE: cat(dim(3), include("0", "1")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("f", "m")) SCALE: cat(dim(1), include("f", "m")) ELEMENT: interval(position(summary.percent(gender*COUNT*minority, base.aesthetic(aesthetic(aesthetic.color.interior)))), color.interior(gender), shape.interior(shape.square), label(COUNT), label(summary.percent(COUNT, base.aesthetic(aesthetic(aesthetic.color.interior))))) END GPL. The first label function displays the count and the second label function displays the percent using the legend variable as the base. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Statmanz Sent: Wednesday, October 15, 2008 11:52 AM To: [hidden email] Subject: Bar Graph with Percent of Bar I am running the following * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=Q8a COUNT()[name="COUNT"] DataSet MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: Q8a=col(source(s), name("Q8a"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) DATA: DataSet=col(source(s), name("DataSet"), unit.category()) COORD: rect(dim(1,2), cluster(3,0)) GUIDE: axis(dim(3), label("Context meet Mentor1")) GUIDE: axis(dim(2), label("Percent")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Data Set")) SCALE: cat(dim(3), include("1", "2", "3", "4")) SCALE: linear(dim(2), include(0)) SCALE: cat(aesthetic(aesthetic.color.interior), include("1", "2", "3", "4")) SCALE: cat(dim(1), include("1", "2", "3", "4")) ELEMENT: interval(position(summary.percent(DataSet*COUNT*Q8a, base.aesthetic(aesthetic(aesthetic.color.interior)))), color.interio r(DataSet), shape.interior(shape.square)) END GPL. The bars heights are fine [as a % compared the total for each Legend (fill color)] but when I apply the labels via Chart Editor the counts are right but the % remains against the total case count instead of the Legend base. Why, and is there a way to change that? I am running V16.0.2. Hope this is clear. Tks, WMB Statistical Services ============ mailto: [hidden email] http:\\home.earthlink.net\~info.statman ============ ===================== 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 |
| Free forum by Nabble | Edit this page |
