Faceted (Paneled) Bar Chart (GPL)

Although the following examples create bar charts, faceting is common to all graphs.

Figure 1. GPL for faceted 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(3), label("Gender"))
  GUIDE: axis(dim(2), label("Mean Salary"))
  GUIDE: axis(dim(1), label("Job Category"))
  ELEMENT: interval(position(summary.mean(jobcat*salary*gender)))
END GPL.
Figure 2. Faceted bar chart
Faceted bar chart
Figure 3. GPL for faceted bar chart with nested categories
* 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.0))
  GUIDE: axis(dim(2), label("Mean Salary"))
  GUIDE: axis(dim(1.1), label("Job Category"))
  GUIDE: axis(dim(1), label("Gender"))
  ELEMENT: interval(position(summary.mean(jobcat/gender*salary)))
END GPL.
Figure 4. Faceted bar chart with nested categories
Faceted bar chart with nested categories
Figure 5. GPL for multi-faceted bar chart
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat gender minority 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: minority=col(source(s), name("minority"), unit.category())
  DATA: salary=col(source(s), name("salary"))
  SCALE: linear(dim(2), include(0))
  GUIDE: axis(dim(4), label("Minority"))
  GUIDE: axis(dim(3), label("Gender"))
  GUIDE: axis(dim(2), label("Mean Salary"))
  GUIDE: axis(dim(1), label("Job Category"))
  ELEMENT: interval(position(summary.mean(jobcat*salary*gender*minority)))
END GPL.
Figure 6. Multi-faceted bar chart
Multi-faceted bar chart