Clustered Bar Chart (GPL)

Figure 1. GPL for clustered bar chart
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat gender salary
  /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: salary=col(source(s), name("salary"))
  COORD: rect(dim(1,2), cluster(3))
  SCALE: linear(dim(2), include(0))
  GUIDE: axis(dim(2), label("Mean Salary"))
  GUIDE: axis(dim(3), label("Gender"))
  ELEMENT: interval(position(summary.mean(jobcat*salary*gender)), color(jobcat))
END GPL.
Figure 2. Clustered bar chart
Clustered bar chart

Following is another option for creating a graph that appears clustered. It uses the dodge collision modifier. (See dodge Collision Modifier (GPL) .) Note that the difference between this and the previous example is that empty space is not allocated for missing categories (in this case, the combination of "Female" and "Custodial").

Figure 3. GPL for dodged bar chart
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat gender salary
  /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: salary=col(source(s), name("salary"))
  SCALE: linear(dim(2), include(0))
  GUIDE: axis(dim(2), label("Mean Salary"))
  GUIDE: axis(dim(1), label("Gender"))
  ELEMENT: interval.dodge(position(summary.mean(gender*salary)), 
                          size(size."25%"), color(jobcat))
END GPL.
Figure 4. Dodged bar chart
Dodged bar chart