Chapter Contents |
Previous |
Next |
The GPLOT Procedure |
Requirements: | At least one plot request is required. |
Global statements: | AXIS, FOOTNOTE, LEGEND, PATTERN, SYMBOL, TITLE |
Supports: | Drill-down functionality |
You can use statement options to manipulate the axes, modify the appearance of your graph, and describe catalog entries. You can use SYMBOL definitions to modify plot symbols for the data points, join data points, draw regression lines, plot confidence limits, or specify other types of interpolations. For more information on the SYMBOL statement, see About SYMBOL Definitions.
In addition, you can
use global statements to modify
the axes; add titles, footnotes, and notes to the plot; or modify the legend
if one is generated by the plot. You can also use an Annotate data set to
enhance the plot.
PLOT plot-request(s) </option(s)>; |
option(s) can be one or more options from any or all of the following categories:
AREAS=n | |
GRID | |
LEGEND | LEGEND=LEGEND<1...99> | |
NOLEGEND | |
OVERLAY | |
REGEQN | |
SKIPMISS |
ANNOTATE=Annotate-data-set | |
CAXIS=axis-color | |
CFRAME=background-color | |
CTEXT=text-color | |
FRAME | NOFRAME | |
NOAXIS | NOAXES |
AUTOHREF | |
CHREF=reference-line-color | |
HAXIS=value-list | AXIS<1...99> | |
HMINOR=number-of-minor-ticks | |
HREF=value-list | |
HZERO | |
LHREF=line-type |
AUTOVREF | |
CVREF=reference-line-color | |
LVREF=line-type | |
VAXIS=value-list | AXIS<1...99> | |
VMINOR=number-of-minor-ticks | |
VREF=value-list | |
VREVERSE | |
VZERO |
catalog entry description options:
DESCRIPTION='entry-description' | |
NAME='entry-name' |
HTML=variable | |
HTML_LEGEND=variable |
Required Arguments |
Note: The nth generated SYMBOL definition is not necessarily the same
as the nth SYMBOL statement. Plot requests of the form y-variable*x-variable=n assign the SYMBOL
definition that is designated by n to the plot that is produced
by y-variable*x-variable. See About Plot Requests that Assign a SYMBOL Definition for more
information.
If you use only one y-variable or only one x-variable, omit the parentheses for that variable, for example,
plot (temp rain)*month;
This plot request produces two plots, one of TEMP and MONTH and one of RAIN and MONTH.
A separate plot (set of data points) is produced for each unique value of third-variable; all plots are drawn on the same set of axes, and a legend is automatically generated to show the plot symbol and color for each value of the classification variable.
Note: If a BY statement is used to produce multiple plots, you can
make the legend the same across graphs by specifying the UNIFORM option in
the PROC GPLOT statement.
The following plot request produces a graph with a plot line for each department and a legend that shows the plot symbol for each department:
plot sales*weekday=dept;
For an example of a plot that specifies a third-variable, see Plotting Three Variables.
You can use more than one type of plot request in a single PLOT statement (provided that you do not specify OVERLAY), for example
plot temp*month rain*month=2;
Options |
See also: | The Annotate Data Set |
If you specify a value for AREAS= that is greater than the number of bounded areas in the plot, the area between the top plot line and the axis frame is filled.
Before an area can be filled, the data points that border the area must be joined by a line. Use a SYMBOL statement with one of these interpolation methods to join the data points:
INTERPOL=JOIN | |
INTERPOL=STEP | |
INTERPOL=Rseries | |
INTERPOL=SPLINE | SM | L |
See SYMBOL Statement for details on interpolation methods.
By default, the AREAS= option fills areas by rotating a solid pattern through the colors list, starting with the first color in the list. If it needs more patterns, it rotates hatch patterns, beginning with the M2N0 pattern (see PATTERN Statement for more information on map/plot patterns). However, if the V6COMP graphics option is in effect, or if color is limited to a single color with the CPATTERN= or COLORS= graphic options, the solid pattern is skipped and the first default pattern is M2N0. If the COLORS= graphic option specifies a single color, use as many SYMBOL statements as you have areas to fill in the plot because the INTERPOL= setting does not automatically apply to multiple symbol definitions.
Note: If your device's default colors list is in effect and
the first color in the list is black, color rotation begins with the second
color in the list (no solid black patterns), unless the V6COMP graphics option
is in effect. See How Default Patterns and Outlines Are Generated
for more information.
You can alter the default pattern behavior by specifying patterns and colors on PATTERN statements that specify map and plot patterns. A separate PATTERN definition is needed for each specified area.
If you specify PATTERN statements, AREAS= uses the lowest numbered PATTERN statement first. If it runs out of patterns, it uses the default behavior for map and plot patterns (see PATTERN Statement for details).
Pattern definitions are assigned to the areas below the plot lines in the order the plots are drawn. The first area is that between the horizontal axis and the plot line that is drawn first. The second area is that above the first plot line and below the plot line that is drawn second, and so forth. If the line that is drawn second lies below the line that is drawn first, the second area is hidden when the first is filled. The plots with the lower line values must be drawn first to prevent one area fill from overlaying another. If the lines cross, only the part of an area that is above the previous line is visible.
Therefore, if you produce multiple plots by submitting multiple plot requests and using the OVERLAY option, the plot requests must be ordered in the PLOT statement so that the plot request that produces the lowest line values is the first (leftmost) plot request, the plot request that produces the next lowest line values is the second plot request, and so on.
If you produce multiple plots with a y-variable*x-variable=third-variable plot request, the lines are plotted in order of increasing third variable values. Therefore, the data must be recoded so that the lowest value of the third variable produces the lowest plot line, the next lowest value produces the next lowest plot line, and so on.
AREAS= works only if all plot lines are generated by the same PLOT or PLOT2 statement.
If you use the VALUE= option in the SYMBOL statement, some symbols may be hidden. If reference lines are also specified with AREAS=, they are drawn behind the pattern fill.
Featured in: | Filling Areas in an Overlay Plot |
If you use the CAXIS= option, it may be overridden by
Featured in: | Connecting Plot Data Points |
If you omit the CTEXT= option, a color specification is searched for in this order:
If you use the CTEXT= option, it overrides the color specification for the axis label and the tick mark values in the COLOR= option in an AXIS definition that is assigned to the axis.
If you use the CTEXT= option, the color specification is overridden in one or more of these situations:
Featured in: | Connecting Plot Data Points |
Featured in: | Connecting Plot Data Points |
The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information, refer to the description of the options, and Substituting BY Line Values in a Text String. The 40-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 40 characters, it is truncated to 40 characters, and then the substitution is performed.
The descriptive text is shown in the "description" portion of each of the following:
For the frame color, a specification is searched for in this order:
To fill the axis area with a background color, use the CFRAME= option.
The way you specify value-list depends on the type of variable:
n <...n> | |
n TO n <BY increment> | |
n <...n> TO n <BY increment > <n <...n> > |
If a numeric variable has an associated format, the specified values must be the unformatted values.
'SAS-value'i < ...'SAS-value'i> | |
'SAS-value'i TO 'SAS-value' i<BY interval> |
'value-1' < ...'value-n'> |
If a character variable has an associated format, the specified values must be the formatted values.
For a complete description of value-list, see the ORDER= option in the AXIS statement.
Note: If data
values fall outside of the range that is specified by the HAXIS= option, then
by default the outlying data values are not used in interpolation calculations.
See About the Input Data Set
for more information on values out of range.
Featured in: | Plotting Two Variables, Connecting Plot Data Points, and Plotting with Different Scales of Values |
Featured in: | Plotting Two Variables, Connecting Plot Data Points, and Plotting with Different Scales of Values |
See also: | CHREF= for a description of color specifications for reference lines |
If you use the SHAPE= option in a LEGEND statement, the value SYMBOL is valid. If you use the PLOT statement's AREAS= option, SHAPE=BAR is also valid.
See also: | LEGEND Statement |
Featured in: | Generating an Overlay Plot |
Featured in: | Connecting Plot Data Points |
The OVERLAY option produces a legend if you include the LEGEND or the LEGEND=n option in the PLOT statement.
You cannot use OVERLAY with plot requests of the form y-variable*x-variable=third-variable. However, you can achieve an overlay effect by using a PLOT and PLOT2 statement.
Featured in: | Generating an Overlay Plot and Filling Areas in an Overlay Plot |
Featured in: | Plotting Two Variables |
See also: | About the Input Data Set for more information about values |
Featured in: | Plotting Two Variables and Connecting Plot Data Points |
Featured in: | Connecting Plot Data Points |
See also: | CVREF= for a description of color specifications for reference lines |
Featured in: | Connecting Plot Data Points |
Plot Requests with Multiple Variables |
Plot requests with multiple variables produce a separate plot for every Y*X pair, unless you specify OVERLAY. For example, this statement produces four plots like those in Graphs Generated by Multiple Plot Requests (the actual plots are produced on separate pages):
plot (y b)*(x a);
Graphs Generated by Multiple Plot Requests
About SYMBOL Definitions |
If no SYMBOL definition is currently in effect, the GPLOT procedure produces a scatter plot of the data points using the default plot symbol, the plus sign (+). If you need more than one SYMBOL definition, the procedure rotates through the current colors list to produce symbols of different colors. If the current colors list contains only one color, or if all the colors are used, additional plot symbols are used.
If SYMBOL definitions have been defined but not explicitly assigned by a plot request of the form y-variable*x-variable=n, the procedure assigns them in the order in which they are generated. For example, this statement creates three plots:
plot y*x b*a s*r;
The procedure assigns the first generated SYMBOL definition to Y*X, the second generated SYMBOL definition to B*A, and the third to S*R.
If more SYMBOL definitions are needed than have been defined, the procedure uses the default definitions for the plots that remain.
See SYMBOL Statement for a complete discussion of the features of the SYMBOL statement.
About Plot Requests that Assign a SYMBOL Definition |
With plot requests of this type it is important to remember that a single SYMBOL statement can generate multiple SYMBOL definitions, so that the SYMBOL definition that is designated by n may not be the same as the SYMBOL statement of the same number. That is, the third SYMBOL definition is not necessarily the same as the SYMBOL3 statement. See SYMBOL Statement for more information.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.