Stylin’

2 Min Read

In my last blog post I shared some templates that added functionality — specifically, maps. That is one use of templates; allowing custom features or new and relatively ‘untested’ features to be used without needing a lot of new user controls, syntax or whatever. A second use is more prosaic, but can be a real […]

In my last blog post I shared some templates that added functionality — specifically, maps. That is one use of templates; allowing custom features or new and relatively ‘untested’ features to be used without needing a lot of new user controls, syntax or whatever. A second use is more prosaic, but can be a real time-saver: custom styles.

Styled Mosaic-like Plot.

The figure above (click to show full-size version) is an example of how a template can contain not only structural information, but also style choices. The range of possible style options available through templates is wider than that available through standard GUI choices, and the above figure shows some gradient details, as well as re-arranging the legend to be in the middle of the chart and making room for it there.

If you download the template from the zip file linked at the bottom of this post, you can use the following SPSS 17 syntax to use it:

GGRAPH
 /GRAPHDATASET NAME="graphdataset"
 VARIABLES=jobcat[LEVEL=nominal] gender[LEVEL=nominal]
   educ[LEVEL=nominal]
 MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=VIZTEMPLATE(NAME="StyledMosaic1"[LOCATION=LOCAL]
 MAPPING( "Y"="store"[DATASET="graphdataset"]
   "BinaryGroup"="hardback"[DATASET="graphdataset"]
   "X"="category"[DATASET="graphdataset"]))
 VIZSTYLESHEET="Traditional"[LOCATION=LOCAL]
 LABEL="StyledMosaic1: hardback-category-store"
 DEFAULTTEMPLATE=NO.

For your data, all you need do is change the data mappings (make sure the BinaryGroup variable really is a categorical variable with two values — a flag, in other words). Enjoy.
StyledMosaicTemplates

Share This Article
Exit mobile version