Chapter Contents

Previous

Next
SAS/GRAPH Software: Reference

Example 3. Rotating Plot Symbols through the Colors List

Features:
GOPTIONS statement options:
COLORS=
HSIZE=
VSIZE=
LEGEND statement options:
LABEL=
SHAPE=
SYMBOL statement options:
HEIGHT=
VALUE=
TITLE statement option:
JUSTIFY=

Sample library member: GR08N03

[IMAGE]

This example specifies a plot symbol on a SYMBOL statement and rotates the symbol through the colors list. Temperature values in the data are represented by the same plot symbol in a different color. The example also shows how default symbol sequencing provides a default plot symbol if a plot needs more plot symbols than are defined.

The example uses the GOPTIONS statement to specify the colors for the color rotation. It also uses a LEGEND statement to specify a two-line legend label, and to align the label with the legend values.

Assign the libref and set the graphics environment. COLORS= specifies the colors list. This list is used by the SYMBOL statement. HSIZE= and VSIZE= specify the external dimensions of the graph. Units of IN override the default PCT specified by GUNIT=.

libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red)
         ftext=swissb htitle=4 htext=3
         hsize=5in vsize=5in;

Create the data set. REFLIB.BACTERIA contains information about the number and size of bacterial divisions at various temperatures.

data reflib.bacteria;
   input temp div mass life @@;
   datalines;
10 3 10 1  20 22 46 0  30 23 20 9   40 42 16 16  50 33 20 6
10 1 11 2  20 01 44 2  30 21 31 10  40 41 14 12  50 31 21 7
10 4 14 3  20 13 32 4  30 24 34 9   40 43 22 14  50 34 24 2
...more data lines...
10 3 02 2  20 09 32 5  30 26 32 9   40 39 22 15  50 36 22 5
10 2 05 3  20 07 35 4  30 24 35 15  40 37 25 14  50 24 35 4
10 3 08 1  20 05 38 6  30 23 28 9   40 35 28 16  50 33 28 6
;

proc sort data=reflib.bacteria;
   by temp;
run;

Define title and footnote. JUSTIFY= breaks the title into two lines.

title1 'Effect of Temperature on the Number'
       justify=center 'and Size of Bacterial
                       Divisions';
footnote1 h=3 j=r 'GR08N03 ';

Define symbol characteristics. HEIGHT= specifies a height for the plot symbols. VALUE= specifies a dot for the plot symbol. Because no color is specified, the symbol is rotated through the colors list. Because the plot needs a fifth symbol, the default plus sign is rotated into the colors list to provide that symbol.

symbol1 height=2
        value=dot;

Define axis characteristics.

axis1 label=('Size (in Angstroms)') length=70;
axis2 label=('Divisions');

Define legend characteristics. LABEL= specifies text for the legend label. J=L specifies a new line and left-justifies the second string under the first. POSITION= aligns the top label line with the first (and in this case only) value row. SHAPE= specifies a width and height for legend values.

legend1 label=(position=(top left)
               'Temperature' j=l '(Celsius)')
        shape=symbol(4,2);

Generate the plot.

proc gplot data=reflib.bacteria;
    plot div*mass=temp / frame
                         haxis=axis1
                         vaxis=axis2
                         legend=legend1;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.