GRAPH plots one series versus another, using a scale determined by the range of each series. The plot may be printed as well as displayed if a hardcopy device such as a Laserjet or dot matrix printer is available. This section describes the graphics version of GRAPH, which is available only for TSP/Oxmetrics, Macintosh TSP, unix, and DOS/Win TSP. For other versions, see the non-graphics GRAPH command.
GRAPH (A4, DASH, DEVICE=<name of printer>, FILE=<name of file>, HEIGHT=<height of letters>, HIRES, LANDSCAP or PORTRAIT, LINE, ORIGIN, PAIR, PREVIEW, SORT, SURFACE, SYMBOL, TITLE='text string to be used as title', WIDTH, XMIN=<x axis minimum>, XMAX=<x axis maximum>, YMIN=<y axis minimum>, YMAX=<y axis maximum>) <x-axis series> <list of y-axis series> ;
or
<x-series 1> <y-series 1> <x-series 2> <y-series 2> ... ; (for the PAIR option)
or
<x series> <y series> <z series> ; (for the SURFACE option)
Usage
GRAPH has several forms, depending on the options specified. If GRAPH is followed by a pair of series names, a scatter plot will be produced using the x-axis for the first series and the y-axis for the second. If there are more than two series names and NOPAIR (the default) is specified, the others will also be plotted on the y-axis, and their points will be connected with a line. This makes it easy to plot fitted and actual values from a regression using the default options (see the example below). If the PAIR option is specified, there must be an even number of series names, and each pair will be plotted versus each other, the first series on the x-axis and the second on the y-axis.
TSP/Oxmetrics automatically displays graphs in different windows by default. If there are gaps in the SMPL, observations with missing data, or the FREQ (PANEL) option is set, any lines being graphed will contain breaks.
In the DOS/Win or MAC version of TSP, the graph will be displayed on the screen; if a DEVICE= is specified, a prompt is also displayed which instructs you to type "P" if you wish to print the graph. If you type anything else, the graph will not be printed; this is useful if you decide you do not like its appearance after you have seen the screen.
The graphics version of GRAPH produces a multi-color scatterplot by default. The first series is graphed with points and the remaining series with lines. The LINE option can be used to graph all series with lines. GRAPH differentiates the series using different colors.
General Oxmetrics only DOS/Win only MAC only
DASH/NODASH specifies whether the lines for different series on the screen are to be distinguished by using different dash patterns. The default is no dashes (just color) on the screen and dashes on printed output. There are 7 dash patterns.
LINE/NOLINE specifies whether the first series should be plotted with a line rather than as a scatter of points. The default is to use dots to represent the series.
ORIGIN/NOORIGIN causes a horizontal line to be drawn starting at zero on the vertical axis.
PAIR/NOPAIR specifies whether all the series except the first are to be plotted on the y-axis (the default) or whether the series are to be used in pairs of x versus y. Since GRAPH always draws a line for every pair of series except the first, it implicitly assumes that the x-axis series will be sorted by the user before the procedure is executed.
PREVIEW/NOPREVIE specifies whether the graph is to be shown on the screen before printing or saving. The default is PREVIEW for interactive use and NOPREVIE for batch use.
SORT/NOSORT controls the ordering of the data on the X-axis so that a line connecting the points will not cross itself.
SYMBOL/NOSYMBOL specifies that symbols are to be used for plotting. When the LINE option is on, NOSYMBOL is the default.
TITLE='a string which will be printed across the top of the graph'.
XMAX= maximum value for the x-axis. This value must be greater than or equal to the maximum value of the x series.
XMIN= minimum value for the x-axis. This value must be less than or equal to the minimum value of the x series.
YMAX= maximum value for the y-axis. This value must be greater than or equal to the maximum value of the y series.
YMIN= minimum value for the y-axis. This value must be less than or equal to the minimum value of the y series.
For convenience, the DEVICE=, FILE=, and HEIGHT= options of GRAPH are retained for the next PLOT(s) or GRAPH(s) until they are overridden explicitly. These options may also be set in a LOGIN.TSP file with a GRAPH statement which does not specify any series to graph.
SURFACE/NOSURFACE specifies that a three-dimensional surface plot is to be created. This option requires 3 variables as arguments.
A4/NOA4 specifies A4 paper size. Available for DEVICE=LJ3 or POSTSCRIPT only.
DEVICE= CHAR or EPSON or LJ2 or LJ3 or LJET or LJPLUS or LJR75 or LJR100 or LJR150 or LJR300 or POSTSCRI or PS specifies the hardcopy device to be used for printer output. LJ means HP LaserJet or compatible, EPSON is EPSON dot matrix or compatible, POSTSCRI and PS are Postcript output, and CHAR is the old line printer output (characters instead of graphics). The LJ suffixes specify models of the printer and the LJR suffixes specify the resolution of the LaserJet printer directly, rather than giving the printer type. The maximum resolutions for the LJET, LJPLUS, and LJ2 printers are 100, 150, and 300 respectively. Note that default larger resolutions imply larger file sizes and printing times.
FILE= the name of a file to which the graphics image is to be written. This file can be printed later. For example, if you are running under DOS and your printer device is LPT1, use the command:
copy/b file LPT1;
HEIGHT= letter height in inches. The default* is .25. Values in the range (0,1] are valid.
HIRES/NOHIRES controls how graphs are printed in batch mode (when PREVIEW is not being used). Normally (NOHIRES), graphs are printed in character mode to the batch output file. When the HIRES option is used, the patched DEVICE= and FILE= will be used; usually this will send a page to LPT1 for each graph.
LANDSCAP/PORTRAIT specifies the orientation of the plot. On the Mac, specify this option in the dialog box.
SURFACE/NOSURFACE specifies that a 3-dimensional surface is to be plotted (TSP/Oxmetrics only). There must be three arguments (x, y, z axis variables). Once you see the plot, you can use ALT>, ALT<, ALT+, and ALT- to rotate the view.
WIDTH/NOWIDTH specifies whether varying width sizes are to be used to distinguish the lines corresponding to different series on the graph.
This graph displays Student's t distribution for 2, 4, and 10 degrees of freedom, a Cauchy distribution, and the Laplace and Normal distributions (chosen to have the same variance as the others):
GRAPH(DEVICE=LJ3,LINE,XMIN=-5,XMAX=5,TITLE='Some Fat-Tailed Distributions') T T2 T4 T10 CAUCHY LAPLACE NORMAL;
The following example plots (and stores on disk) the graph shown in the user's guide:
SMPL 1,1000;
RANDOM (SEEDIN=49813) X E;
Y = 1 + X + E;
OLSQ Y C X;
GRAPH(DEV=LJ3,PREVIEW,FILE ='GRAPH.PLT', TITLE ='Actual and Fitted Values') X Y @FIT;