Binning over Categorical Values (GPL)

This example demonstrates how you use binning to show the distribution of a continuous variable over categorical values.

Figure 1. GPL for binning over categorical values
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat salary
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: jobcat = col(source(s), name("jobcat"), unit.category())
  DATA: salary = col(source(s), name("salary"))
  GUIDE: axis(dim(1), label("Employment Category"))
  GUIDE: axis(dim(2), label("Current Salary"))
  GUIDE: legend(aesthetic(aesthetic.color), label("Count"))
  ELEMENT: polygon(position(bin.rect(jobcat*salary, dim(2))), color(summary.count()))
END GPL.
Figure 2. Binning over categorical values
Binning over categorical values