Stylin’

Posted By Graham Wills on Feb 19, 2009 at 12:02 PM
Filed Under Clementine, SPSS Statistics v17, Visualization 

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

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

Technorati Tags: Mosaic Plot, Paneling, Styles, Templates, Visualization

Bookmark and Share
Print This Post   Email This Post  


Comments

4 Responses to “Stylin’”

  1. Will Bailey on March 10th, 2009 1:18 pm

    Nice, keep adding new and ‘better’ template options.

    I notice that if it is set-up in the Graphboard and paste the syntax the following line is inserted

    Panel across”=”resid”[DATASET="graphdataset"]

    where resid is the panel split variable.

    With this line in the panels are shifted (1 high and the other lower, hope clear), if deleted then the panels are properly aligned.

  2. Will Bailey on March 10th, 2009 1:22 pm

    Forgot to add - How can I later the split key from “hardback” to something else in the syntax since can edit the graph produces in the viewer?

    Tks

  3. Graham Wills on March 10th, 2009 1:50 pm

    Will,
    I think there’s a bug in our syntax paste code so that when you have a paneling actually in the template, it shows up both as a variable in the template, like it’s supposed to, and also as if you had selected the variable in the Graphboard options tab. One for us to work on for the next release. Glad you found a work-around.

    Without the VizDesigner product, if you want to edit the actual template, you have to know a bit about XML. But if all you want to do is modify the mapping, you should be able to do that from syntax. Maybe give a bit more detail about exactly what you are looking to do?

  4. Will Bailey on March 11th, 2009 12:57 pm

    Guess this also slipped by us when working with the beta.

    Anyway, just curious as to if via syntax can change the split panel headings from hardback= to the variable label, like Gender=

Leave a Reply or Trackback from your own site




Security Code: