Chapter Contents |
Previous |
Next |
The GCONTOUR Procedure |
Requirements: | A plot request is required. |
Global statements: | AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, TITLE |
The PLOT statement automatically
Note: You cannot
produce overlaid
contour plots with PROC GCONTOUR alone.
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)>; |
y*x=z |
option(s) can be one or more options from any or all of the following categories:
ANNOTATE=Annotate-data-set | |
CAXIS=axis-color | |
CFRAME=background-color | |
COUTLINE=outline-color | |
CTEXT=text-color | |
GRID | |
NOAXIS | NOAXES | |
NOFRAME |
AUTOHREF | |
CHREF=reference-line-color | |
HAXIS=AXIS<1...99> | |
HMINOR=number-of-minor-ticks | |
HREF=value-list | |
HREVERSE | |
LHREF=line-type | |
XTICKNUM=number-of-ticks |
AUTOVREF | |
CVREF=reference-line-color | |
LVREF=line-type | |
VAXIS=AXIS<1...99> | |
VMINOR=number-of-minor-ticks | |
VREF=value-list | |
VREVERSE | |
YTICKNUM=number-of-ticks |
CLEVELS=color(s) | |
JOIN | |
LEGEND=LEGEND<1...99> | |
LEVELS=value-list | |
LLEVELS=line-type-list | |
NLEVELS=number-of-levels | |
NOLEGEND | |
PATTERN |
AUTOLABEL | AUTOLABEL=(autolabel-suboptions)
|
catalog entry description options:
DESCRIPTION='entry-description' | |
NAME='entry-name' |
Required Arguments |
y | is the variable that is plotted on the vertical (y) axis. |
x | is the variable that is plotted on the horizontal (x) axis. |
z | is the variable that is plotted as contour lines. |
Options |
See also: | The Annotate Data Set |
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.
Featured in: | Labeling Contour Lines |
If you use the CAXIS= option, it may be overridden by the COLOR= suboption of the MAJOR= or MINOR= option in an AXIS definition.
This option is ignored if AUTOLABEL is used.
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.
Featured in: | Using Patterns and Joins |
If you omit the CTEXT= option, a color specification is searched for in this order:
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.
Featured in: | Using Patterns and Joins |
See also: | AXIS Statement |
Featured in: | Labeling Contour Lines |
Featured in: | Using Patterns and Joins |
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.
See also: | LEGEND Statement |
Featured in: | Labeling Contour Lines |
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.
Featured in: | Labeling Contour Lines and Specifying Contour Levels |
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.
Featured in: | Specifying Contour Levels |
L
represents an array of
levels:
D = (Zmax - Zmin) / NLEVELS d = 0.5 * D L[0] = Zmin + d, L[i] = L[i-1] + D
In this case, each level is the midpoint of a number of ranges equal to the value of the NLEVELS= option. These ranges exactly cover the range of the z variable.
e = 0.05 * (100 - NLEVELS) / 93 d = (Zmax - Zmin) * e D = ((Zmax - Zmin - 2*d) / (NLEVELS - 1) L[0] = Zmin + d, L[i] = L[i-1] + D
In this case, the first and last midpoints are set closer to the minimum and maximum z values as the values of NLEVELS= gets closer to 100, and the remaining midpoints are equally spaced between them.
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.
See also: | Selecting Contour Levels |
Featured in: | Using Patterns and Joins |
See also: | AXIS Statement |
Featured in: | Labeling Contour Lines |
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.
Autolabel Suboptions |
In the AUTOLABEL= option, autolabel-suboptions can be one or more of the suboptions described here.
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.
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:
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.
Selecting Contour Levels |
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.
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.
Specifying Axis Order |
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
Modifying Contour Lines and Labels with the SYMBOL Statement |
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.
SYMBOL Statement Option | Contour Line or Label Element Affected |
---|---|
LINE=line-type |
Contour line style |
WIDTH=n |
Contour line thickness |
CI=line-color or COLOR=color |
Contour line color |
FONT=font |
Contour label font |
HEIGHT=height |
Contour label height |
CV=color or COLOR=color |
Contour label color |
STEP=distance<units> | Minimum distance between labels on the same contour line |
VALUE='text' | Contour label text |
VALUE=NONE | Suppresses the contour label text |
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.
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.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.