|
I am looking for a possibility
to do the following chart with GPL. I amusing SPSS 15. *=========================*. New File. DATA LIST LIST
(",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GRAPH /BAR(SIMPLE)=
N(a) N(b) N(c) N(d) N(e) N(f)
/MISSING=VARIABLEWISE . *=========================*. Thanks in advance. Christian ********************************** Christian Schmidhauser, Dr.phil.II |
|
la volta statistics wrote:
> > I am looking for a possibility to do the following chart with GPL. I > am using SPSS 15. > > > > *=========================*. > > New File. > > DATA LIST LIST (",")/ a b c d e f. > > BEGIN DATA > > 1,1,1,1,,1 > > 1,1,1,1,1,1 > > 1,,1,1,1,1 > > 1,,1,1,,1 > > 1,,1,1,1,1 > > 1,1,,1,1,1 > > 1,,,1,1,1 > > 1,1,,,1,1 > > 1,,1,1,1,1 > > 1,,1,1,1,1 > > END DATA. > > > > GRAPH > > /BAR(SIMPLE)= N(a) N(b) N(c) N(d) N(e) N(f) > > /MISSING=VARIABLEWISE . > > *=========================*. > > > > Hi Christian: Only workaround I found involved restructuring the dataset: VARSTOCASES /MAKE counts FROM a b c d e f /INDEX = Index(counts) /NULL = DROP. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=Index COUNT()[name="COUNT"] /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: Index=col(source(s), name("Index"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("Index")) GUIDE: axis(dim(2), label("Counts")) SCALE: cat(dim(1)) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(Index*COUNT), shape.interior(shape.square)) END GPL. HTH, Marta GG -- For miscellaneous SPSS related statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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 |
|
In reply to this post by la volta statistics
Here’s how it’s done via Chart Builder: GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=VALIDN(a) VALIDN(b) VALIDN(c) VALIDN(d) VALIDN(e) VALIDN(f) MISSING=VARIABLEWISE REPORTMISSING=NO TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SUMMARY=col(source(s), name("#SUMMARY")) DATA: INDEX=col(source(s), name("#INDEX"), unit.category()) GUIDE: axis(dim(2), label("Valid N")) SCALE: cat(dim(1), include("0", "1", "2", "3", "4", "5")) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(INDEX*SUMMARY), shape.interior(shape.square)) END GPL. This effectively does a VARSTOCASES internally. To do this with Chart Builder: Either set the level of the variables to SCALE externally via the VARIABLE LEVEL command or within Chart Builder by right clicking on the selected variables in the list. Drag all the selected variables together onto the Y axis. This generates two pseudo vars mapping to values and variable index. Within chart properties change each element to Valid N since the default is mean. Be sure to hit apply. Hit run or paste. From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics I am looking for a possibility to do the following chart with GPL. I amusing SPSS 15. *=========================*. New File. DATA LIST LIST (",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GRAPH /BAR(SIMPLE)= N(a) N(b) N(c) N(d) N(e) N(f) /MISSING=VARIABLEWISE . *=========================*. Thanks in advance. Christian ********************************** Christian Schmidhauser, Dr.phil.II |
|
Thanks ViAnn,
that helped. But now I have an
additional problem: I managed to add
the counts on top of the bars and the percentages in the middle (see syntax). Is
it possible to add a leading or trailing character to the data labels? I would
like to have "N = " in front of the counts and a trailing
"%" after the percentages. I tried something such as ELEMENT:
point(position(INDEX*SUMMARY)), scale(x1),
size(size."1px"),color.exterior(color."99FFFF"), label("N
= ", summary.sum(SUMMARY)))) but this seems
not to work. Not even the label("This is a
", "long label") from
the GPL reference guide works here. Additionally: Is it
possible to center the data labels within the bar? They are all shifted slightly
to the right. Thanks in advance Christian *=========================*. New File. DATA LIST LIST (",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GGRAPH /GRAPHDATASET
NAME="graphdataset" VARIABLES=VALIDN(a) VALIDN(b) VALIDN(c) VALIDN(d)
VALIDN(e) VALIDN(f)
MISSING=VARIABLEWISE REPORTMISSING=NO
TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC
SOURCE=INLINE. BEGIN GPL SOURCE:
s=userSource(id("graphdataset")) DATA:
SUMMARY=col(source(s), name("#SUMMARY")) DATA:
INDEX=col(source(s), name("#INDEX"), unit.category()) GUIDE:
axis(dim(2), label("Valid N")) TRANS: t =
eval(SUMMARY/2) SCALE: x1 =
cat(dim(1), include("0", "1", "2", "3",
"4", "5")) SCALE:
linear(dim(2), include(0)) ELEMENT:
interval(position(INDEX*SUMMARY), scale(x1), shape.interior(shape.square),
color.interior(color."99FFFF"),
color.exterior(color."99FFFF"))) ELEMENT:
point(position(INDEX*SUMMARY)), scale(x1),
size(size."1px"),color.exterior(color."99FFFF"), label(summary.sum(SUMMARY)))) ELEMENT:
point(position(INDEX*t)), scale(x1), size(size."1px"),
color.exterior(color."99FFFF"),
label(summary.percent.sum(SUMMARY)))) END GPL. *=========================*. **********************************
Christian
Schmidhauser, Dr.phil.II Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im
Auftrag von ViAnn Beadle Here’s how
it’s done via Chart Builder: GGRAPH /GRAPHDATASET
NAME="graphdataset" VARIABLES=VALIDN(a) VALIDN(b) VALIDN(c) VALIDN(d)
VALIDN(e) VALIDN(f)
MISSING=VARIABLEWISE REPORTMISSING=NO
TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC
SOURCE=INLINE. BEGIN GPL SOURCE:
s=userSource(id("graphdataset")) DATA: SUMMARY=col(source(s),
name("#SUMMARY")) DATA:
INDEX=col(source(s), name("#INDEX"), unit.category()) GUIDE:
axis(dim(2), label("Valid N")) SCALE:
cat(dim(1), include("0", "1", "2", "3",
"4", "5")) SCALE:
linear(dim(2), include(0)) ELEMENT:
interval(position(INDEX*SUMMARY), shape.interior(shape.square)) END GPL. This effectively
does a VARSTOCASES internally. To do this with
Chart Builder: Either set the level
of the variables to SCALE externally via the VARIABLE LEVEL command or within
Chart Builder by right clicking on the selected variables in the list. Drag all the
selected variables together onto the Y axis. This generates two pseudo vars
mapping to values and variable index. Within chart
properties change each element to Valid N since the default is mean. Be sure to
hit apply. Hit run or paste. From:
SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la I am looking for a
possibility to do the following chart with GPL. I amusing SPSS 15. *=========================*. New File. DATA LIST LIST
(",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GRAPH
/BAR(SIMPLE)= N(a) N(b) N(c) N(d) N(e) N(f)
/MISSING=VARIABLEWISE . *=========================*. Thanks in advance. Christian ********************************** Christian Schmidhauser, Dr.phil.II |
|
You cannot concatenate a number and a string in the label function. You can concatenate strings as shown in the help. You can specify multiple label functions within an element. You are getting the offset because you are attaching your labels to a point element which isn’t invisible even though it’s the same color as bars and which takes up space. Within the chart editor you can specify both the N value and the percent value but you cannot place them at different locations. I’d recommend the following. Don’t try to make the top N label, it’s totally redundant with the Y axis labeling. If that’s too subtle, provide a grid. Attach the percent label to the interval ELEMENT. It will show up in the middle of the bar by default. Use a template to append the percent sign to it. So you end up with one element statement. Note that you don’t need the SCALE subcommand to define a separate x axis scale. From: la volta statistics [mailto:[hidden email]] Thanks ViAnn, that helped. But now I have an additional problem: I managed to add the counts on top of the bars and the percentages in the middle (see syntax). Is it possible to add a leading or trailing character to the data labels? I would like to have "N = " in front of the counts and a trailing "%" after the percentages. I tried something such as ELEMENT: point(position(INDEX*SUMMARY)), scale(x1), size(size."1px"),color.exterior(color."99FFFF"), label("N = ", summary.sum(SUMMARY)))) but this seems not to work. Not even the label("This is a ", "long label") from the GPL reference guide works here. Additionally: Is it possible to center the data labels within the bar? They are all shifted slightly to the right. Thanks in advance Christian *=========================*. New File. DATA LIST LIST (",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=VALIDN(a) VALIDN(b) VALIDN(c) VALIDN(d) VALIDN(e) VALIDN(f) MISSING=VARIABLEWISE REPORTMISSING=NO TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SUMMARY=col(source(s), name("#SUMMARY")) DATA: INDEX=col(source(s), name("#INDEX"), unit.category()) GUIDE: axis(dim(2), label("Valid N")) TRANS: t = eval(SUMMARY/2) SCALE: x1 = cat(dim(1), include("0", "1", "2", "3", "4", "5")) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(INDEX*SUMMARY), scale(x1), shape.interior(shape.square), color.interior(color."99FFFF"), color.exterior(color."99FFFF"))) ELEMENT: point(position(INDEX*SUMMARY)), scale(x1), size(size."1px"),color.exterior(color."99FFFF"), label(summary.sum(SUMMARY)))) ELEMENT: point(position(INDEX*t)), scale(x1), size(size."1px"), color.exterior(color."99FFFF"), label(summary.percent.sum(SUMMARY)))) END GPL. *=========================*. ********************************** Christian Schmidhauser, Dr.phil.II Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von ViAnn Beadle Here’s how it’s done via Chart Builder: GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=VALIDN(a) VALIDN(b) VALIDN(c) VALIDN(d) VALIDN(e) VALIDN(f) MISSING=VARIABLEWISE REPORTMISSING=NO TRANSFORM=VARSTOCASES(SUMMARY="#SUMMARY" INDEX="#INDEX") /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SUMMARY=col(source(s), name("#SUMMARY")) DATA: INDEX=col(source(s), name("#INDEX"), unit.category()) GUIDE: axis(dim(2), label("Valid N")) SCALE: cat(dim(1), include("0", "1", "2", "3", "4", "5")) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(INDEX*SUMMARY), shape.interior(shape.square)) END GPL. This effectively does a VARSTOCASES internally. To do this with Chart Builder: Either set the level of the variables to SCALE externally via the VARIABLE LEVEL command or within Chart Builder by right clicking on the selected variables in the list. Drag all the selected variables together onto the Y axis. This generates two pseudo vars mapping to values and variable index. Within chart properties change each element to Valid N since the default is mean. Be sure to hit apply. Hit run or paste. From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics I am looking for a possibility to do the following chart with GPL. I amusing SPSS 15. *=========================*. New File. DATA LIST LIST (",")/ a b c d e f. BEGIN DATA 1,1,1,1,,1 1,1,1,1,1,1 1,,1,1,1,1 1,,1,1,,1 1,,1,1,1,1 1,1,,1,1,1 1,,,1,1,1 1,1,,,1,1 1,,1,1,1,1 1,,1,1,1,1 END DATA. GRAPH /BAR(SIMPLE)= N(a) N(b) N(c) N(d) N(e) N(f) /MISSING=VARIABLEWISE . *=========================*. Thanks in advance. Christian ********************************** Christian Schmidhauser, Dr.phil.II |
| Free forum by Nabble | Edit this page |
