Display a spike graph view.
Syntax
spike(options) o1 [o2 o3 ... ]
object_name.spike(options) [categorical_spec(arg)]
where o1, o2, ..., are series or group objects.
Following the spike keyword, you may specify general graph characteristics using options. Available options include multiple graph handling, dual scaling, template application, data contraction, adding axis extensions, and rotation.
The optional
categorical_spec allows you to specify a categorical graph (see
“Categorical Spec”).
Options
Scale options
a (default) | Automatic single scale. |
d | Dual scaling with no crossing. The first series or column is scaled on the left and all other series or columns are scaled on the right. |
x | Dual scaling with possible crossing. See the “d” option. |
n | Normalized scale (zero mean and unit standard deviation). |
rotate | Rotate the graph so the observation axis is on the left. |
ab=type | Add axis border along data scale, 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 options (categorical graph settings will override these options)
m | Plot spikes in multiple graphs. |
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 spike graph. |
The options which support the “–” may be preceded by a “+” or “–” indicating whether to turn on or off the option. The “+” is optional.
Graph data options
The following option is available in non-panel or 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.) |
Categorical graph options
These options only apply to categorical graphs, which are described below and specified by the within and across categorical spec. The graph must have 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
spike(rotate, m) pop oldsales newsales
displays a rotated spike graph of the series POP, OLDSALES, and NEWSALES, with each series in a separate frame.
pop.spike
displays a spike graph of the series POP.
group mygrp oldsales newsales
mygrp.spike(l, x, o=mytpt)
plot a spike graph of OLDSALES together with a line graphs of NEWSALES. The spike graph is scaled on the left, while the line graph is scaled on the right. The graph uses options from the graph MYTPT as a template.
mygrp.spike(o=midnight, b)
creates a spike graph of MYGRP, using the settings of the predefined template “midnight.”
mygrp.spike(rotate, contract=mean)
displays a rotated spike graph of the means of the series in MYGRP.
Panel examples
ser1.spike(panel=individual)
displays spike graphs for each cross-section in a separate frame, while,
ser1.spike(panel=median)
displays a spike graph of the medians for each period computed across cross-sections.
Categorical spec examples
ser1.spike across(firm, dispname)
displays a categorical spike graph of SER1 using distinct values of FIRM to define the categories, and displaying the resulting graphs in multiple frames.
ser1.spike across(firm, dispname, iscale)
shows the same graph with individual scaling for each of the frames.
ser1.spike within(contract=mean, firm, inctot, label=value)
displays a spike graph of mean values of SER1 categorized by firm (along with an added category for the total), with all of the graphs in a single frame and the FIRM category value used as labels.
ser1.spike(contract=sum) across(firm, dispname) within(income, bintype=quant, bincount=4)
constructs a categorical spike graph of the sum of SER1 values within a category. Different firms are displayed in different graph frames, using the display name as labels, with each frame containing spikes depicting the sum of SER1 for each income quartiles.
group mygrp oldsales newsales
mygrp.spike(contract=min) within(@series) within(age)
displays spike graphs of the minimum values for categories defined by distinct values of AGE (and the two series). All of the spike will be displayed in a single frame with the spikes for OLDSALES grouped together followed by the spikes for NEWSALES.
g1.spike(o=midnight, b, w)
creates a spike graph of the group G1, using the settings of the predefined template “midnight”, applying the bold and wide modifiers.
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.