Display an XY line graph view (if possible).
There must be at least two series or columns to create an XY line graph. By default, the first series or column will be located along the horizontal axis, with 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).
XY line graphs are simply XY plots with lines turned on and symbols turned off (see
Graph::setelem).
Syntax
xyline(options) o1 o2 [o3 ... ]
object_name.xyline(options) [auxiliary_spec(arg)] [categorical_spec(arg)]
where o1, o2, ..., are series or group objects.
Following the xyline 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 | Plot XY lines 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 “pairs” options is the same as using the
xypair command.) |
s | Stacked XY line graph. Each line represents the cumulative total of the series or columns listed. The difference between lines 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 lines 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). (Note: more general versions of these panel graphs may be constructed as categorical graphs.) |
Examples
Basic examples
xyline age height weight length
displays XY-line plots with AGE on the horizontal and HEIGHT, WEIGHT and LENGTH on the vertical axis.
group g1 age height weight length
g1.xyline
displays the same graph using the named object G1.
g1.xyline(m, ab=hist)
displays the same information in multiple frames with histograms along the borders.
g1.xyline(s, t=scat2)
displays a stacked XY-line graph, using the graph object SCAT2 as a template.
g1.xyline(d)
shows XY-line plots with dual scales and no crossing.
Panel examples
g1.xyline(panel=combined)
displays XY-line for series in G1 in a single frame with lines for different cross-sections for a given pair identified using different symbols and colors.
g1.xyline(panel=individual)
displays the graphs for each of the cross-sections in a different frame.
g1.xyline(panel=stacked)
displays the same plot, but with lines drawn from the beginning of the stacked panel to the end.
Categorical examples
group cgrp income consumption
cgrp.xyline within(sex)
displays a scatterplot categorized by values of sex, with both categories displayed in the same graph frame using different symbols and colors.
cgrp.xyline(contract=mean) within(state)
computes mean values for the series in CGRP for each STATE category, and displays the results in a single graph frame using a single line to connect the mean values.
cgrp.xyline across(state) within(sex)
displays line plots for data with each STATE value in different frames. Within each frame, the data for each value of SEX are drawn as a separate line.
Cross-references
scat is a specialized form of an XY graph.
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.