SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Plots
Enhancing Plots


Specifying Color

You can also specify color for plotting symbols and interpolated lines using the COLOR= (or C=) option. This SYMBOL statement specifies a red plotting symbol and line:

     symbol1 value=square interpol=spline
             height=1 cm width=2.5 color=red; 

This plot shows the effect of the COLOR=RED option.


Display plot with COLOR=red option.


Important Tip: Specifying Color for Multiple Plot Lines

In general, it is easier to relate SYMBOL statements to plot lines if you specify a color for each SYMBOL statement. If you do not, you may get unexpected results, as illustrated by the example below.

You might expect the following program to produce two plot lines, one with square plotting symbols and one with triangle plotting symbols. However, as you can see in the resulting plot, both plot lines have square plotting symbols.

     symbol1 interpol=spline value=square;
     symbol2 interpol=spline value=triangle;
     proc gplot data=clinic.therapy1999;
        plot swim*month aerclass*month/overlay;
     run;

Display plot without COLOR= option.

Here's why the result is not what you may have expected: if you don't specify the COLOR= option in a SYMBOL statement, SAS/GRAPH software cycles that SYMBOL statement through the current colors list for your device before using the next SYMBOL statement. This can result in one SYMBOL statement spawning a large number of plot definitions. In this case, the SYMBOL1 statement was rotated through the first two colors in the color list, black and red. The SYMBOL2 statement was not needed and so was not used.

Note: The capability of SAS software to generate many plot definitions from one SYMBOL statement can work to your advantage. Just remember that if you do not specify a color for each SYMBOL statement, there will not be a one-to-one correspondence between SYMBOL statements and plot lines.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement