surface | Draw color 3D surface plot with contours in X-Y plane | surface |
The SURFACE macro draws a 3D color-coded surface plot, showing a contour plot in the X-Y plane. The result is most useful for smooth surfaces, e.g., for functional relations, Z=f(X,Y), bivariate density estimates computed with PROC KDE, or with the result of PROC G3GRID.
The surface and the contour plot are constructed using filled polygons in Annotate datasets. The contour is identical to the surface, with the Z coordinate set to the constant 'floor'.
The SURFACE macro is defined with keyword parameters. The X=
, Y=
and
Z=
parameters are required.
The arguments may be listed within parentheses in any order, separated
by commas. For example:
%surface(x=temperature, y=pressure, z=yield);
DATA=_LAST_
]
X=X
]
Y=Y
]
Z=Z
]
COLORS=HLS
generates
NLEVELS=
colors varying in hue in the HLS color scheme Hhhh80FF.
COLORS=HLS
llss, where llss are hex digits, generates HLS colors
with lightness ll and saturations ss. Otherwise, COLORS=
is taken
as a blank separated list of SAS colors of length NLEVELS=
.
[Default: COLORS=HLS
]
NLEVELS=12
]
TICKNUM=5
]
DROP=1
]
TILT=75
]
ROTATE=40
]
FUZZ=1E-6
]
COLORS=HLS
, OPTIONS=REVERSE
reverses the
assignment of colors to heights (Z=
values) in the plot.
OUTANNO=SURFANNO
]
GOUT=GSEG
]
NAME=SURFACE
]
*-- Generate bivariate normal data; data bivar; do i = 1 to 10000; x = rannor(2140); y = -x + 3* rannor(2140); output; end; run;
*-- Do bivariate density estimation; proc kde data=bivar out=kdeout; var x y; run;
%include macros(surface); *-- or include in an autocall library; %surface(data=kdeout, x=x, y=y, z=density, where=-3 < x < 3)Plot with reversed Blues palette:
%brewerpal(n=9, palette=Blues, result=blues9, order=REV); %surface(data=kdeout, x=x, y=y, z=density, colors=&blues9, nlevels=9, where=-3See also
brewerpal Generate Brewer color palette(s)
ellipses Plot bivariate data ellipses
mvnormal Generate multivariate normal samples
sunplot Sunflower plot for X-Y data