A continuous legend
maps the data range of a response variable to a range of colors. Continuous
legends can be used with the following plot statements when the enabling
plot option is also specified.
A contour plot provides
the CONTOURTYPE= option, which you can use to manage the contour display.
The following graph illustrates the values that are available for
the CONTOURTYPE= option.
All of the variations
that support color, except for LINE and LABELEDLINE, can have a legend
that shows the value of the required Z= column. For example, the following
code generates a contour plot with CONTOURTYPE=FILL:
proc template;
define statgraph contour;
begingraph;
entrytitle "CONTOURTYPE=FILL";
layout overlay / xaxisopts=(offsetmin=0 offsetmax=0)
yaxisopts=(offsetmin=0 offsetmax=0);
contourplotparm x=Height y=Weight z=Density / name="cont"
contourtype=fill ;
continuouslegend "cont" / title="Density";
endlayout;
endgraph;
end;
run;
proc sgrender data=sashelp.gridded template=contour;
where height>=53 and weight<=225;
run;
If you change to CONTOURTYPE=GRADIENT
you get the following output:
For a FILL contour,
the Z variable is split into equal-sized value ranges, and each range
is assigned a different color. The continuous legend shows the value
range boundaries and the associated colors as a long strip of color
swatches with an axis on it. The contour options NHINT= and NLEVELS=
are used to change the number of levels (ranges) of the contour. NHINT=10
requests that a number near ten be used that results in "good" intervals
for displaying in the legend. NLEVELS=10 forces ten levels to be used.
contourplotparm x=Height y=Weight
z=Density / name="cont"
contourtype=fill nhint=10 ;
continuouslegend "cont" /
title="Density";
You can think of a GRADIENT
contour as a FILL contour with a very large number of levels. A color
ramp is displayed with an axis that shows reference points that are
within the data range. The number of reference points is determined
by default.
When a CONTINUOUS legend
is used with a plot that uses gradient color, the VALUESCOUNT= and
VALUESCOUNTHINT= options can be used to manage the legend's gradient
axis. These options are similar to the NLEVELS= and NHINT= plot options.
continuouslegend "cont" /
title="Density"
valuecounthint=5 ;
continuouslegend "cont" /
title="Density"
valuecounthint=10 ;