Creates
contour plots using values of three numeric variables
from the input data set as the source of the contour coordinates.
| Requirements: |
A plot request is required.
|
| Global statements: |
AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, TITLE
|
The
PLOT statement specifies the three variables to plot. Optionally, it controls
the contour levels, labels the plot lines, and modifies axes as well as the
general appearance of the graph. Only one plot request can be specified in
a PLOT statement. To specify multiple plots for a single PROC GCONTOUR statement,
use multiple PLOT statements.
The PLOT statement automatically
Note:
You cannot
produce overlaid
contour plots with PROC GCONTOUR alone. ![[cautend]](../common/images/cautend.gif)
You can use global statements to modify the axes, the
legend, the contour lines and contour line labels, and the fill patterns and
pattern colors for contour areas. You can also add titles, footnotes, and
notes to the chart, and you can use an Annotate data set to enhance the chart.
|
PLOT plot-request
</option(s)>;
|
plot-request must be
option(s) can be one or more options from
any or all of the following categories:
-
y*x=z
-
specifies three numeric variables
from the input data set:
You can specify as many PLOT options
as you want,
and you can list them in any order. If you use a BY statement on the procedure,
the options in each PLOT statement affect all graphs produced by that BY statement.
-
ANNOTATE=Annotate-data-set
ANNO=Annotate-data-set
-
specifies a data set to annotate
charts produced by the PLOT statement.
-
AUTOHREF
-
draws reference lines at all major
tick marks on the horizontal axis.
-
AUTOLABEL |
AUTOLABEL=(autolabel_suboptions)
-
automatically labels the contour
lines. Autolabel-suboptions can be one or more of the suboptions
described in Autolabel Suboptions.
The label for each contour line is the z
value for that contour level. By default, labels are displayed in BEST format.
To change the format, use a FORMAT statement.
When AUTOLABEL is used, the LLEVELS= and CLEVELS= options
are ignored and the SYMBOL statement controls label text and contour-line
attributes. For more information on the SYMBOL statement, see Modifying Contour Lines and Labels with the SYMBOL Statement.
Even though AUTOLABEL
labels the contour lines, a default
legend is still generated. To suppress the legend, use the NOLEGEND option.
-
AUTOVREF
-
draws reference lines at all major
tick marks on the vertical axis.
-
CAXIS=axis-color
-
specifies a color for axis lines
and all major and minor tick marks. By default, axes are displayed in the
second color in the colors list.
If you use the CAXIS= option, it may be overridden
by the COLOR= suboption of the MAJOR= or MINOR= option in an AXIS definition.
-
CFRAME=background-color
CFR=background-color
-
fills the axis area with the specified
color and automatically draws a frame around the axis area.
-
CHREF=reference-line-color
CH=reference-line-color
-
specifies the color for reference
lines that are requested by the HREF= option. By default, these lines are
displayed in the axis color.
-
CLEVELS=color(s)
-
specifies a list of colors for plot
contour levels. The number of specified colors should correspond to the number
of contour levels since one color represents each level of contour. If fewer
colors are specified than the number of levels in the plot, the procedure
provides default colors from the current colors list. The procedure default
is to rotate through the current colors list for each line type.
This option is ignored if AUTOLABEL is
used.
-
COUTLINE=outline-color
-
specifies a color for outlining filled
areas. This option is ignored unless the PATTERN option is also used. By
default, the outline color is the same as the color of the filled area.
Note:
The outline color is the only distinction between empty
patterns. Use of this option makes the patterns look the same when VALUE=EMPTY
in PATTERN definitions. ![[cautend]](../common/images/cautend.gif)
-
CTEXT=text-color
-
specifies a color for all text on
the axes and legend, including axis labels, tick mark values, legend labels,
and legend value descriptions.
If you omit the CTEXT= option, a color specification
is searched for in this order:
-
specified colors on assigned AXIS and LEGEND
statements
-
the CTEXT= option in a GOPTIONS statement
-
the default, the first color in the colors
list.
For legend text, colors that you specify on an assigned
LEGEND statement override CTEXT=. Thus, a LEGEND statement's VALUE= color
is used for legend values, and its LABEL= color is used for legend labels.
For axes text, colors that you explicitly specify for
values and labels on an assigned AXIS statement override CTEXT=. Thus, an
AXIS statement's VALUE= color is used for axis values, and its LABEL= color
is used for axis labels. However, if the AXIS statement specifies only general
axis colors with its COLOR= option, the CTEXT= color overrides that general
specification and is used for axis labels and values; the COLOR= color is
still used for all other axis colors, such as tick marks.
If you use a BY statement in the procedure, the color
of the BY variable labels is controlled by the CBY= option in the GOPTIONS
statement.
-
CVREF=reference-line-color
CV=reference-line-color
-
specifies the color for reference
lines that are requested by the VREF= option. By default, these lines are
displayed in the axis color.
-
DESCRIPTION='entry-description'
DES='entry-description'
-
specifies the description of the
catalog entry for the chart. The maximum length for entry-description is 40 characters. The description does not appear on the chart. By
default, the GCONTOUR procedure assigns a description of the form PLOT OF y*x=z, where y*x=z is the request specified in the PLOT
statement.
-
GRID
-
draws reference lines at all major
tick marks on both axes. This is the same as specifying both AUTOHREF and
AUTOVREF.
-
HAXIS=AXIS<1...99>
-
assigns axis characteristics from
the corresponding AXIS definition to the horizontal (x) axis.
-
HMINOR=number-of-minor-ticks
HM=number-of-minor-ticks
-
specifies the number of minor tick
marks to use between each major tick mark on the horizontal (x)
axis. No values are displayed for minor tick marks. HMINOR= overrides the
MINOR= option in an AXIS definition assigned to the horizontal (x)
axis.
-
HREF=value-list
-
draws one or more reference lines
perpendicular to the horizontal axis at points specified by value-list. See the LEVELS= option for a
description of value-list.
-
HREVERSE
-
specifies that the order of the values
on the horizontal axis be reversed.
-
JOIN
-
combines adjacent grid cells with
the same pattern to form a single pattern area. This option is ignored unless
the PATTERN option is also used.
-
LEGEND=LEGEND<1...99>
-
assigns legend characteristics to
the legend to adjust the location, text, and appearance of axes on the plots.
The option value indicates which LEGEND definition to use. To suppress the
legend, use the NOLEGEND option. The LEGEND= option is ignored if the specified
LEGEND definition is not currently in effect.
If you use the SHAPE= option in a LEGEND statement,
the value LINE is valid. If you use the PATTERN option, SHAPE=BAR is also
valid.
-
LEVELS=value-list
-
specifies values of z
for plot contour levels and therefore changes the number of contour levels.
You can specify up to 100 values. By default, the GCONTOUR procedure plots
seven contour levels for z. These levels occur at every 15th
percent of the range between the 5th and 95th percentiles.
For numeric variables, value-list can
be an explicit list of values, a starting and an ending value with an interval
increment, or a combination of both forms:
If a numeric variable has an associated format, the
specified values must be the unformatted values.
By default, the GCONTOUR procedure selects colors and
line types for the contour levels by rotating through the colors list for
each line type (1 through 46) until all the levels have been represented.
The level lines on the plot represent the intersection of a plane, parallel
to the x-y plane, and the surface that is formed by the data
at the z value. See Selecting Contour Levels for more information.
You can specify the colors
and line types for contour
levels. The way to do this depends on whether AUTOLABEL is used:
As an alternative to representing contour levels with
contour lines, you can use the PATTERN option to fill each level with a solid
pattern or with the colors and patterns specified in PATTERN statements.
-
LHREF=line-type
LH=line-type
-
specifies the line type for drawing
reference lines that are requested by the HREF= option. Line-type
is a number from 1 to 46. The default is LHREF=1, a solid line. See Specifying Line Types for
available line types.
-
LLEVELS=line-type-list
-
lists numbers for line types for
plot contour lines. Each line type represents one contour level, so the number
of line types listed should correspond to the number of contour levels. Thus,
for a contour plot that uses the default seven levels, specify seven line
types.
If fewer line types are specified than the number of
levels in the plot, the procedure provides default line types. With the default,
contour levels rotate through line types 1 through 46, displaying each line
type in all of the colors in the colors list before moving to the next line
type. See Specifying Line Types
for available line types.
For colors and lines specified with both the CLEVELS=
and LLEVELS= options, the first contour level is displayed in the first color
in the CLEVELS= color list and in the first line type specified with the LLEVELS=
option. The second level is displayed in the second color and the second
line type, and so on.
This option is ignored if AUTOLABEL is used.
-
LVREF=line-type
LV=line-type
-
specifies the line type for drawing
reference lines that are requested by the VREF= option. Line-type
is a number from 1 to 46. The default is LVREF=1, a solid line. See Specifying Line Types for
available line types.
-
NAME='entry-name'
-
specifies the name of the catalog
entry for the graph. The maximum length for entry-name is 8
characters. The default name is GCONTOUR. If the specified name duplicates
the name of an existing entry, SAS/GRAPH
software adds a number to the duplicate name to create a unique entry, for
example, GCONTOU1.
-
NLEVELS=number-of-levels
-
specifies the number of contour levels
to plot. Values can be integers from 1 to 100, inclusive. The contour levels
are computed as follows, where
L represents an array of
levels:
-
NOAXIS
NOAXES
-
specifies that a plot have no axes,
axis values, or axis labels. The frame is displayed around the plot unless
you use the NOFRAME option.
-
NOFRAME
-
suppresses the frame that is drawn
by default around the plot area.
-
NOLEGEND
-
suppresses the plot legend that describes
contour levels and their line types or fill patterns and colors.
-
PATTERN
-
specifies the fill pattern and pattern
colors for contour areas. The plot contour levels are represented by rectangles
filled with patterns. The pattern for each rectangle is determined by calculating
the mean of the values of the z variable for the four corners
of the rectangle and assigning the pattern for the level closest to the mean.
By default, the procedure uses a solid pattern for the
levels and rotates the pattern through the colors list. If the V6COMP option
is in effect for the GOPTIONS statement, cross-hatch patterns are used instead
of solid patterns. To explicitly define patterns, use PATTERN definitions
for map/plot patterns.
-
VAXIS=AXIS<1...99>
-
assigns axis characteristics from
the corresponding AXIS definition to the vertical (y) axis.
-
VMINOR=number-of-minor-ticks
VM=number-of-minor-ticks
-
specifies the number of minor tick
marks located between each major tick mark on the vertical (y)
axis. No values are displayed for minor tick marks. The VMINOR= option overrides
the MINOR= option in an AXIS definition that is assigned to the vertical (y) axis.
-
VREF=value-list
-
draws one or more reference lines
perpendicular to the vertical axis at points specified by value-list. See the LEVELS= option for a
description of value-list.
-
VREVERSE
-
specifies that the order of the values
on the vertical axis be reversed.
-
XTICKNUM=number-of-ticks
YTICKNUM=number-of-ticks
-
specify the number of major tick
marks located on a plot's x or y axis, respectively.
The value of n must be 2 or greater. The defaults are XTICKNUM=5
and YTICKNUM=5.
The MAJOR= or ORDER= option in an AXIS definition that
is assigned to the x axis overrides the XTICKNUM= option. The
MAJOR= or ORDER= option in an AXIS definition that is assigned to the y axis overrides the YTICKNUM= option.
In the AUTOLABEL= option, autolabel-suboptions can be one or more of the suboptions
described
here.
-
CHECK=checking-factor | NONE
-
specifies a collision checking factor
that controls collisions between contour label text and other contour lines
or other labels. Values can be integers from 0 to 100, inclusive, where 0
provides minimal collision checking and 100 provides maximal collision checking.
Fractional values are permitted. The default is CHECK=75.
CHECK=NONE suppresses contour label collision checking
and may substantially lessen the time needed to compute the contour graph.
Specifying a checking factor can slow the graph procedure.
Generally, CPU time required to fit all the labels increases in direct proportion
to the size of the CHECK= number.
-
MAXHIDE=amount<units>
-
specifies the maximum amount of contour
line that can be hidden by contour labels. The value of amount
must be greater than zero.
Valid units are CELLS (horizontal character
cell positions), CM (centimeters), IN (inches), or PCT (percentage of the
width of the graphics output area). The default is MAXHIDE=100PCT. If you
omit units, a unit specification is searched for in this order:
-
the GUNIT= option in a GOPTIONS
statement
-
the default unit, CELLS.
If you specify units of PCT or CELLS, the MAXHIDE= suboption
calculates the amount of contour line that can be hidden based on the width
of the graphics output area. For example, if you specify MAXHIDE=50PCT and
if the graphics output area is 9 inches wide, the maximum amount of the contour
line that can be hidden by labels is 4.5 inches.
This option maintains data integrity. It provides a
check for overly small increments in the STEP= option in the SYMBOL statement.
Additionally, it can prevent small contours from being significantly hidden
even when the value of STEP= is sufficiently large.
-
REVEAL
-
specifies that the contour lines
are visible through the label text as dashed lines. Line style 33 is used.
This option provides a simple way to see all portions of labeled contours
and can be used to inspect the label positions with respect to the contour
lines. It is primarily used for debugging. Occasionally, single-character
contour labels can be placed off center from the clipped portion of the contour
line when the contour line is irregular or jagged.
-
TOLANGLE=angle
-
specifies the maximum angle (the
tolerance angle) between any two adjacent characters of a contour label. The
value of angle must be between 1 and 85 degrees, inclusive.
The default is TOLANGLE=30. To force contour labels to fall on very smooth
sections, specify a small tolerance angle.
You can use the LEVELS= option
to select the contour levels for your plot. You use LEVELS= values differently,
depending on whether you specify the PATTERN option in the PLOT statement.
When you do not use
the PATTERN option, the levels represent the intersection of a plane (parallel
to the x-y plane at the z value) and the surface
formed by the data. That is, if you use the data to create a surface plot
with the G3D procedure, the contour lines in a GCONTOUR procedure plot represent
the intersection of the plane and the surface.
For example, suppose that you use the G3D procedure,
and your data produces a surface plot like the one shown in Surface Plot. The same data used with
this PLOT statement in the GCONTOUR procedure produces a contour plot like
the one in Line Contour Levels:
plot y*x=z / levels=-7.5 to 7.5 by 2.5;
The contour lines in
Line Contour Levels
represent the intersection of the surface in Surface Plot with planes parallel to the plane formed
by the variables x and y and located at z values of --7.5, --5.0, --2.5, and so
on.
Surface Plot
Line Contour Levels
When you use the PATTERN option,
contour levels are represented by rectangles filled with patterns. The rectangles
are formed by points in the x-y grid. The contour pattern of
a rectangle, or grid cell, is determined by the mean or average value of the z variable for the four corners of the rectangle. The grid cell is
assigned the pattern for the level closest to the calculated mean. For example,
if you have specified contour levels of 0, 5, and 10, and the plot contains
a grid cell with a mean of 100, it is assigned the pattern for the nearest
level: 10. A grid cell with a mean of 7.6 will also be assigned the pattern
for the 10 level.
Pattern Contour Levels
shows a contour plot with the PATTERN option that uses the same data and contour
levels as Line Contour Levels.
The pattern for the rectangle is assigned depending on the mean of the grid
values at the four corners. As a result, two contour plots using the same
contour levels can present your data differently if one plot uses a pattern
and the other does not. The contour pattern boundaries do not correspond
to the contour lines shown in Line Contour Levels.
Pattern Contour Levels
You can use AXIS statements to modify
the text and appearance of plot axes, and then you can assign the axes to
the contour plot with the PLOT statement's HAXIS= and VAXIS= options. If the
AXIS statement uses an ORDER= option, there are special considerations for
using that AXIS definition with the GCONTOUR procedure.
A list of variable values that are specified with the
AXIS statement's ORDER= option must contain numbers listed in ascending or
descending order; these numbers are treated as a continuous data range for
an axis. Thus, for a contour line or pattern to span the entire specified
range, it is not necessary for the maximum and minimum values of the list
to match exactly with the maximum and minimum data values of the corresponding x or y variable. For example, suppose that you assign
this AXIS definition to the horizontal (x) axis:
axis1 order=-2.5 to 2.5 by .5
Suppose also that the horizontal axis variable has these
values: --5, --4, --3, --2, --1, 0, 1, 2, 3, 4, 5.
Depending on the data, contours could extend through the full range of the
ORDER= list rather than from --2 to 2, which are the actual values of
the variable assigned to the horizontal (x) axis. In this case,
values are interpolated for the x variable at any point where
the y variable intersects the minimum axis value (--2.5)
or the maximum axis value (2.5). Data values that are outside of the axis
range (in this case, --5, --4, --3, 3, 4, and 5) are clipped
from the plot.
When ORDER=
lists cause data clipping, internal plotting grids are modified according
to these rules:
In addition, if you assign the following AXIS definition
to a plot of the same data, the contour levels on the plot will not extend
beyond the range of the data:
axis1 order=-10 to 10 by 1;
To see the effects of the ORDER= option:
Effects of the AXIS Statement's ORDER= Option: ORDER= values match variable values
Effects of the AXIS Statement's ORDER= Option: ORDER= range is smaller than variable range
Effects of the AXIS Statement's ORDER= Option: ORDER= range is larger than variable range
When you use the AUTOLABEL option, the LLEVELS= and CLEVELS=
options are ignored, and contour-line and label attributes are controlled
by the SYMBOL statement. Defaults are used if not enough SYMBOL statements
are specified to match the number of contour levels.
If a SYMBOL statement does not include a
color option, that
statement may be applied to more than one contour level. In this case, the
SYMBOL statement is used once with every color in the colors list and generates
more than one SYMBOL definition. See SYMBOL Statement for details.
The Effect of SYMBOL Statement Options on Contour Lines and Labels
describes how SYMBOL statement options affect contour plot lines and labels.
The SYMBOL statement
option INTERPOL= is not supported by the GCONTOUR procedure.
The
STEP= option specifies
the minimum distance between contour labels. The lower the value, the more
labels the procedure uses. A STEP= value of less than 10 percent is ignored
by the GCONTOUR procedure and a value of 10 percent is substituted.
See STEP= for more
information.
To override the default labels that are displayed by the AUTOLABEL
option, you can specify label text for one or more contour lines. To do so,
use both the FONT= and VALUE= options on the SYMBOL statement that is assigned
to the contour level. Default labels are used for contour levels that you
do not label.
For example, this SYMBOL1 statement displays the text
string
Highest in the Swiss font on the contour line that
it modifies:
symbol1 font=swiss value='Highest';
You must specify both FONT= and VALUE= or the text is
not used. For an example, see
Labeling Contour Lines.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.