Chapter Contents

Previous

Next
The GCONTOUR Procedure

Example 3: Specifying Contour Levels


Procedure features:
PLOT statement options:
LEVELS=
LLEVELS=
Sample library member: GR14N03

[IMAGE]

This example generates a contour plot that shows the height or depth of a pond and its surrounding land. In the example, the PLOT statement uses the LEVELS= and LLEVELS= options to specify explicit contour levels and line types for the contour plot. It also uses a LEGEND statement to modify the plot's default legend.

This example uses the G3GRID procedure to interpolate points for grid cells that do not have a needed dimension in the data. Without the G3GRID procedure, there are too many missing values for the point locations, and the GCONTOUR procedure cannot produce a satisfactory contour plot.
 Note about code
libname reflib 'SAS-data-library';
goptions reset=global gunit=pct border cback=white
         colors=(black blue green red)
         ftext=swiss ftitle=swissb htitle=6 htext=3;
 Note about code
data reflib.pond;
   input vdist hdist height;
   datalines;
10    88       0
18    55      -1
24    22.5    -1.67
...more data lines...
64    272.5  -6.25
60    277.5  -6.5
62    277.5  -6.5
;
 Note about code
title 'Bottom Contour of Mill Pond';
footnote j=r 'GR14N03 ';
 Note about code
axis1 order=(0 to 325 by 25) width=3 minor=(n=4)
      label=('Feet');
axis2 order=(0 to 100 by 25) width=3 minor=(n=4)
      label=(' Feet');
 Note about code
legend1 frame shape=line(7)
        label=(position=top j=c 'Height or Depth (in feet)');
 Note about code
proc g3grid data=reflib.pond out=reflib.pondgrid;
   grid vdist*hdist=height / naxis1=100 naxis2=100;
run;
 Note about code
proc gcontour data=reflib.pondgrid;
   plot vdist*hdist=height /levels= -30 -12 -7  -3 0 3 5 7 12
                            llevels=  1   1  1  1  1 2 2 2 2  2
                            legend=legend1
                            haxis=axis1
                            vaxis=axis2;
run;
quit;


Chapter Contents

Previous

Next

Top of Page

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