|Statistical Graphics Using ODS|
The section Modifying Tick Marks and Grid Lines explains that grid lines in graphs are controlled both by template options and by the style. Some graphs never display grid lines because they would interfere with the display. Some graphs always display grid lines because they are a critical part of the display. In both cases, grid control is so important that the template writer is not willing to give control to the style. If you want to change the grid display setting for these graphs, you must edit their templates. Most templates, however, let the style control the grid lines. They either do not display grid lines unless the style forces them on, or they display grid lines unless the style forces them off. The STATISTICAL, DEFAULT, and most other styles use the setting DisplayOpts = "Auto". Then templates that specify GRIDDISPLAY=AUTO_OFF (the default) do not display grid lines, and templates that specify GRIDDISPLAY=AUTO_ON do display grid lines. You can easily make a new style with DisplayOpts = "On" or DisplayOpts = "Off" if you would prefer to see grid lines more or less often. This example shows how to set DisplayOpts = "On".
First, you need to find the style source for setting grid lines. The following step displays the STATISTICAL and DEFAULT styles:
proc template; source Styles.Statistical; source Styles.Default; run;
The advantage of displaying both styles together is you can do one search of the results. If grids are defined in the STATISTICAL style, you will find that first. Otherwise, you will first find the definition in the DEFAULT style. An abridged version of the results follows:
. . . class GraphGridLines / displayopts = "auto" linethickness = 1px linestyle = 1 contrastcolor = GraphColors('ggrid') color = GraphColors('ggrid'); . . .
You can use this to create a new style that inherits from the STATISTICAL style, but sets the display options for grids to ON, as in the following example:
proc template; define style Styles.MyGrids; parent=styles.statistical; class GraphGridLines / displayopts = "on" linethickness = 1px linestyle = 1 contrastcolor = GraphColors('ggrid') color = GraphColors('ggrid'); end; run;
You can use this new style as in the following example:
ods graphics on; ods listing style=mygrids; proc robustreg data=stack plots=qqplot; ods select QQPlot; model y = x1 x2 x3; run;
The preceding statements produce Output 21.5.7, which shows the Q-Q plot with grid lines displayed. The default graph template, supplied by SAS, is used because the custom template created in the section Modifying Tick Marks and Grid Lines is deleted at the end of that section.
Copyright © SAS Institute, Inc. All Rights Reserved.