Object Reference : Graph Creation Commands
  
 
scat
Display a scatterplot (if possible).
A scatterplot graph plots the values of one series or column against another using symbols.
There must be at least two series or columns to create a scatterplot. By default, the first series or column will be located along the horizontal axis, and the remaining data on the vertical axis. You may optionally choose to plot the data in pairs, where the first two series or columns are plotted against each other, the second two series or columns are plotted against each other, and so forth, or to construct graphs using all possible pairs (or the lower triangular set of pairs).
Scatterplots are simply XY-line plots with symbols turned on and lines turned off (see Graph::setelem).
Syntax
scat(options) o1 o2 [o3 ... ]
object_name.scat(options) [auxiliary_spec(arg)] [categorical_spec(arg)]
where o1, o2, ..., are series or group objects.
Following the scat keyword, you may specify general graph characteristics using options. Available options include plotting the data in pairs or in multiple graphs, template application, and adding axis extensions.
The optional auxilary_spec allows you to add fit lines to the scatterplot (regression lines, kernel fit, nearest neighbor fit, orthogonal regression, and confidence ellipses; see “Auxiliary Spec”).
The optional categorical_spec allows you to specify a categorical graph (see “Categorical Spec”).
Options
Scale options
 
a (default)
Automatic single scale.
b
Plot series or columns in pairs (the first two against each other, the second two against each other, and so forth).
d
Dual scaling with no crossing.
x
Dual scaling with possible crossing.
n
Normalized scale (zero mean and unit standard deviation). May not be used with the “s” option.
ab=type
Add axis border along data scales, where type may be “hist” or “h” (histogram), “boxplot” or “b”, “kernel” or “k”.
(Note: axis borders are not available for panel graphs with “panel=” options that involve summaries: mean, median, etc.)
Multiple series pair options (categorical graph settings will override these options)
 
m
Place scatterplots in multiple graphs.
mult=mat_type
Multiple series or column handling: where mat_type may be: “pairs” or “p” - pairs, “mat” or “m” - scatterplot matrix, “lower” or “l” - lower triangular matrix. (Using the “mat” or “lower” options is the same as using the scatmat command; using the “pairs” option is the same as using scatpair.)
s
Stacked scatterplot graph. Each symbol represents the cumulative total of the series or columns listed. The difference between symbols corresponds to the value of a series or column.
Template and printing options
 
o=template
Use appearance options from the specified template. template may be a predefined template keyword (“default” - current global defaults, “classic”, “modern”, “reverse”, “midnight”, “spartan”, “monochrome”) or a graph in the workfile.
t=graph_name
Use appearance options and copy text and shading from the specified graph.
b / -b
[Apply / Remove] bold modifiers of the base template style specified using the “o=” option above.
w / -w
[Apply / Remove] wide modifiers of the base template style specified using the “o=” option above.
reset
Resets all graph options to the global defaults. May be used to remove existing customization of the graph.
p
Print the graph.
The options which support the “–” may be preceded by a “+” or “–” indicating whether to turn on or off the option. The “+” is optional.
Note that use of the template option will override the symbol setting.
Graph data options
The following option is available in categorical graph settings:
 
contract=key
Contract the data as specified by key, where key may be: “mean”, “median”, “max”, “min”, “sum”, “var” - variance, “sd” - standard deviation, “sumsq” - sum of the squared values, “skew” - skewness, “kurt” - kurtosis, “nas” - number of missing values, “obs” - number of observations, “unique” - error if the series is not identical for all observations in a given group, “first” - first observation in category using workfile order, “last” - last observation in category using workfile order, “quant(quantile)” - where quantile is a number between 0 and 1.
Panel options
The following option applies when graphing panel structured data.
 
panel=arg (default taken from global settings)
Panel data display: “stack” (stack the cross-sections), “individual” or “i” (separate graph for each cross-section), “combine” or “c” (combine cross-section graphs in a single frame), “mean” (plot means across cross-sections), “median” (plot median across cross-sections).
Categorical graph options
These options only apply to categorical graphs ( “Categorical Spec”) where the graph has one or more within factors and a contraction method other than raw data (see the contract option above).
 
favorlegend
Favor the use of legends over axis labels to describe categories.
elemcommon = int
Specifies the number of within factors for which the graph uses common area colors. For example, with multiple within dimensions, if “elemcommon=1”, then only categories defined by the first within factor will have common colors. If “elemcommon=2”, then categories defined by the first two within factors will have common colors. If “elemcommon=0”, all areas will have different colors.
The default is one less than the number of within factors.
Examples
Basic examples
scat(m) age height weight length
displays scatterplots with AGE on the horizontal and HEIGHT, WEIGHT and LENGTH on the vertical axis in multiple frames.
group g1 age height weight length
g1.scat
displays the same scatterplots in a single frame.
g1.scat(m, ab=hist)
displays the same information in multiple frames with histograms along the data axes.
g1.scat(mult=pairs) linefit
plots AGE against HEIGHT and WEIGHT against LENGTH (along with a regression fit line) in a single graph frame.
g1.scat(s, t=scat2)
displays a stacked scatterplot, using the graph object SCAT2 as a template.
g1.scat(d, ab=kernel)
shows a scatterplot with dual scales and no crossing, with kernel density plots along the borders.
Panel examples
g1.scat(panel=combined)
displays a scatterplot for the series in G1 in a single frame with observations for different cross-sections identified using different symbols and colors.
g1.scat(panel=individual)
draws each cross-section scatter in a different graph frame.
g1.scat(panel=stacked)
displays the same plot, but with observations drawn with common color and symbol.
g1.scat(panel=stacked, contract=mean) linefit kernfit
constructs a scatterplot using the mean values computed across cross-sections (for a given period) and displays it in a single graph frame, along with regression and kernel regression fits. The “panel=-stacked” option instructs EViews to display the observations using a single symbol type and color, and to fit lines using all of the data depicted in the graph.
Categorical examples
group cgrp income consumption
cgrp.scat within(sex)
displays a scatterplot categorized by values of sex, with both categories displayed in the same graph frame using different symbol types and colors.
cgrp.scat within(sex) kernfit linefit
displays the same graph along with linear and kernel regression fits for each category.
cgrp.scat(contract=mean) nnfit within(state)
computes mean values for the series in CGRP for each STATE category, and displays the results in a single graph frame along with a line depicting the linear regression fit to the mean values.
cgrp.scat across(state) within(sex) nnfit
displays scatterplots for data with each STATE value in different frames. Within each frame, the data for each value of SEX are depicted using different symbol types and colors, and a nearest neighbor regression is fit to observations in each category.
Cross-references
See “Graphing Data” for a detailed discussion of graphs in EViews, and “Templates” for a discussion of graph templates.
See Graph::graph for graph declaration and other graph types.
For a description of the available fit lines, see “Auxiliary Graph Types”.
See xyline for a description of XY graphs.