Chapter Contents

Previous

Next
The GCONTOUR Procedure

Example 4: Using Patterns and Joins


Procedure features:
PLOT statement options:
COUTLINE=
CTEXT=
JOIN
PATTERN
Sample library member: GR14N04

[IMAGE]

This example demonstrates the differences between using lines and patterns to represent contour levels. It first uses a simple PLOT statement to generate the default output, which uses lines to represent contour levels.

As shown in the following output, the example then modifies the PLOT statement by specifying the PATTERN option, which uses patterns to distinguish between contour levels. Additional PLOT statement options outline filled areas in gray and specify green text for all text on the axes and in the legend.

[IMAGE]

Finally, as shown by the following output, the example uses the JOIN option to combine the patterns in grid cells for the same contour level. Additional options enhance the plot by modifying the axes and framing the legend.

[IMAGE]

 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=4;
 Note about code
data reflib.swirl;
   do x= -5 to 5 by 0.25;
      do y= -5 to 5 by 0.25;
         if x+y=0 then z=0;
         else z=(x*y)*((x*x-y*y)/(x*x+y*y));
         output;
      end;
   end;
run;
 Note about code
title 'Simple Contour Plot';
footnote j=r 'GR14N04(a) ';
 Note about code
proc gcontour data=reflib.swirl;
   plot y*x=z;
run;
 Note about code
title 'Representing Contour Levels with Patterns';
footnote j=r 'GR14N04(b) ';
 Note about code
proc gcontour data=reflib.swirl;
   plot y*x=z / pattern
                coutline=gray
                ctext=green;
run;
 Note about code
title 'Joining the Patterns in a Contour Plot';
footnote j=r 'GR14N04(c) ';
 Note about code
axis1 label=none value=('' ' ' '0' ' ' '5')
      color=red width=3;
axis2 label=none value=('' ' ' '0' ' ' '5')
      color=red width=3;

legend frame;
 Note about code
proc gcontour data=reflib.swirl;
   plot y*x=z / pattern
                join
                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.