Procedure features: |
COUTLINE, CTEXT, HAXIS, JOIN, LEGEND,
PATTERN
|
Data Set |
SWIRL
|
Sample library member: |
GCTPATJN
|
This example demonstrates the differences
between using lines and patterns to represent contour levels. The first PLOT
statement generates a plot with lines representing contour levels.
Line Contour Levels
![[Line Contour Levels]](images/gctpatr1.gif)
The second PLOT statement specifies the PATTERN
option to fill and color
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.
Pattern Contour Levels
![[Pattern Contour Levels]](images/gctpatr2.gif)
The third PLOT statement uses the JOIN option
to combine adjacent grid
cells with the same pattern to form a single pattern area. Additional options
enhance the plot by modifying the axes and framing the legend.
Contour Plot with Joined Cells
![[Contour Plot with Joined Cells]](images/gctpatr3.gif)
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
goptions reset=all border; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
data 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](../../../../common/63294/HTML/default/images/snbut.gif) |
title1 "Line Contour Levels";
footnote1 j=r "GCTPATR1"; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc gcontour data=swirl;
plot y*x=z;
run;
quit; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
title1 "Pattern Contour Levels";
footnote j=r "GCTPATR2"; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc gcontour data=swirl;
plot y*x=z /
ctext=green
coutline=gray
pattern;
run;
quit; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
title "Contour Plot with Joined Cells";
footnote j=r "GCTPATR3"; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
axis1 label=none
value=("-5" '' "0" '' "5")
color=red
width=3;
axis2 label=none
value=("-5" '' "0" '' "5")
color=red
width=3;
|
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
legend1 frame; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc gcontour data=swirl;
plot y*x=z /
haxis=axis1
join
legend=legend1
pattern
vaxis=axis2;
run;
quit; |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.