|
Hi fellow SPSSlisters,
I'm trying to create a histogram that shows the number of students who received each score on a standardized test. The problem is that I want to show how many males received each score and how many females received each score side by side on the same graph. Specifically, I want the order to be like this: number of males who scored a one, number of females who scored a one, number of males who scored a two, number of females who scored a two, etc. The closest I have come is to use the GUI, go to the Groups/ Point ID tab, check Grouping/stacking variable, and use gender as the grouping/stacking variable. This works, but it stacks the bars on top of one another when I want them side by side. The syntax from this graph is below. I also tried to use the bar graph instead of histogram and I was able to get the bars side by side, but then I have a bar graph, not a histogram. I hope all of this is clear. Thanks for any help you can provide. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=SS1 S08GenderCombined MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SS1=col(source(s), name("SS1")) DATA: S08GenderCombined=col(source(s), name("S08GenderCombined"), unit.category()) GUIDE: axis(dim(1), label("SS1")) GUIDE: axis(dim(2), label("Frequency")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("S08Gender with ", "Missing Filled from Fall")) SCALE: cat(aesthetic(aesthetic.color.interior)) ELEMENT: interval.stack(position(summary.count(bin.rect(SS1))), color.interior(S08GenderCombined), shape.interior(shape.square)) END GPL. ____________________________________ Justin Meyer Researcher Rowland Reading Foundation 1 South Pinckney Street, Suite 324 Madison, WI 53703 phone: 866-370-7323 fax: 608-204-3846 www.rowlandreading.org <http://www.rowlandreading.org/> ____________________________________ ====================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 |
|
Theoretically there is no such thing as a grouped histogram. In a histogram
the X axis is scale, so you can't have two bin centers with equal values side-by-side. They have to be in the same location on that scale. The most effective way of showing the differences between males and females is to overlay the two histograms. When one histogram is overlaid on another, there is a high probability that one bar will completely occlude another bar. The way to solve this problem is to make the bars a bit transparent. Here's the way to do that using an the Employee Data.sav sample file: GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salary gender MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salary=col(source(s), name("salary")) DATA: gender=col(source(s), name("gender"), unit.category()) GUIDE: axis(dim(1), label("Current Salary")) GUIDE: axis(dim(2), label("Frequency")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Gender")) SCALE: cat(aesthetic(aesthetic.color.interior), include("f", "m")) ELEMENT: interval(position(summary.count(bin.rect(salary))), color.interior(gender), shape.interior(shape.square), transparency(transparency.".50")) END GPL. This syntax was generated with chart builder and modified as follows: The stack modifier is removed from the interval function. The transparency function is added to the ELEMENT statement specifying 50% transparency. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Justin Meyer Sent: Monday, October 13, 2008 3:35 PM To: [hidden email] Subject: Histogram Grouped by Gender Hi fellow SPSSlisters, I'm trying to create a histogram that shows the number of students who received each score on a standardized test. The problem is that I want to show how many males received each score and how many females received each score side by side on the same graph. Specifically, I want the order to be like this: number of males who scored a one, number of females who scored a one, number of males who scored a two, number of females who scored a two, etc. The closest I have come is to use the GUI, go to the Groups/ Point ID tab, check Grouping/stacking variable, and use gender as the grouping/stacking variable. This works, but it stacks the bars on top of one another when I want them side by side. The syntax from this graph is below. I also tried to use the bar graph instead of histogram and I was able to get the bars side by side, but then I have a bar graph, not a histogram. I hope all of this is clear. Thanks for any help you can provide. * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=SS1 S08GenderCombined MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: SS1=col(source(s), name("SS1")) DATA: S08GenderCombined=col(source(s), name("S08GenderCombined"), unit.category()) GUIDE: axis(dim(1), label("SS1")) GUIDE: axis(dim(2), label("Frequency")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("S08Gender with ", "Missing Filled from Fall")) SCALE: cat(aesthetic(aesthetic.color.interior)) ELEMENT: interval.stack(position(summary.count(bin.rect(SS1))), color.interior(S08GenderCombined), shape.interior(shape.square)) END GPL. ____________________________________ Justin Meyer Researcher Rowland Reading Foundation 1 South Pinckney Street, Suite 324 Madison, WI 53703 phone: 866-370-7323 fax: 608-204-3846 www.rowlandreading.org <http://www.rowlandreading.org/> ____________________________________ ======= 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 |
