SAS Institute. The Power to Know

SAS/GRAPH(R) 9.2: Graph Template Language Reference

Previous | Next
Overview

The LATTICE Layout

The LATTICE layout is a multi-cell layout with special features for combining plot data ranges in columns or rows, aligning corresponding plot areas across cells when possible, and externalizing axis information so it is not repeated in each cell. This layout and the OVERLAY are the most important and frequently used layouts.

In the following example, the lattice has one column and two rows.

  • The first row cell contains an overlay consisting of a histogram, normal distribution curve, and "fringe plot" that shows the location of individual observations under the histogram bins.
  • The second row cell contains a boxplot that shows the data median (line), mean (diamond marker), interquartile range, and outliers.
  
 proc template; 
   define statgraph distribution; 
     begingraph; 
     entrytitle "Distribution of Scores"; 
       layout lattice / columns=1 rows=2 
                      rowweight=(.9 .1) 
                      columndatarange=union 
                      rowgutter=2px; 
         columnaxes; 
           columnaxis / label="Score" ; 
         endcolumnaxes; 
         layout overlay / yaxisopts=(offsetmin=.03); 
           histogram score / scale=percent; 
           densityplot score / normal( ) ; 
           fringeplot score; 
         endlayout; 
         boxplot y=score / orient=horizontal; 
       endlayout; 
     endgraph; 
   end; 
 run;
 
ovlattice.gif (86554 bytes)


The overlay is apportioned 90% of the available height and the boxplot 10%. The data ranges for the X axes of the two cells are merged, and an COLUMNAXIS statement externalizes a single X axis and sets its label.

Previous | Next | Top of Page