Question About Faceted Bar Charts

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

Question About Faceted Bar Charts

bdates
Can a faceted bar chart be used with more than two groups? I use the syntax below to produce a chart that distinguishes between two groups, typically intervention and comparison. I'm evaluating several programs which have more than one intervention group, so perhaps a chart comparing three intervention types and one comparison group. When I enter more than two codes in the the SCALE for dim3, e.g., "1","2","3","4", I get a chart with no bars for any of the groups. What am I missing?

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=BPRS group MISSING=
  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: BPRS=col(source(s), name("BPRS"))
 DATA: group=col(source(s), name("group"), unit.category())
 GUIDE: axis(dim(1), label("BPRS"))
 GUIDE: axis(dim(2), label("Frequency"))
 GUIDE: axis(dim(3), label("Group"), opposite())
 SCALE: cat(dim(3), include("1","2"))
 ELEMENT: interval(position(summary.count(bin.rect(BPRS*1*group))) ,
   shape.interior(shape.square))
END GPL.

Thanks for any insight.

Brian


Brian Dates
===================== 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: Question About Faceted Bar Charts

bdates
Dear all. Thank-you for any thoughts you may have had. I solved the problem. Sorry to trouble the listserv.

Brian

From: Dates, Brian
Sent: Sunday, February 16, 2020 11:13 AM
To: [hidden email] <[hidden email]>
Subject: Question About Faceted Bar Charts
 
Can a faceted bar chart be used with more than two groups? I use the syntax below to produce a chart that distinguishes between two groups, typically intervention and comparison. I'm evaluating several programs which have more than one intervention group, so perhaps a chart comparing three intervention types and one comparison group. When I enter more than two codes in the the SCALE for dim3, e.g., "1","2","3","4", I get a chart with no bars for any of the groups. What am I missing?

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=BPRS group MISSING=
  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: BPRS=col(source(s), name("BPRS"))
 DATA: group=col(source(s), name("group"), unit.category())
 GUIDE: axis(dim(1), label("BPRS"))
 GUIDE: axis(dim(2), label("Frequency"))
 GUIDE: axis(dim(3), label("Group"), opposite())
 SCALE: cat(dim(3), include("1","2"))
 ELEMENT: interval(position(summary.count(bin.rect(BPRS*1*group))) ,
   shape.interior(shape.square))
END GPL.

Thanks for any insight.

Brian


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