It is frequently the case that several datasets need to be displayed on the same plot. If so, you may wish to distinguish the points in different datasets by joining them by lines of different types, or by using marker symbols of different types.
A more complicated example would be the following. You may have a file containing a dataset that is the result of experimental observations, and a file containing closely spaced points that trace out a theoretical curve. The second file is a dataset in its own right. You would presumably plot it with line segments joining successive data points, so as to trace out the theoretical curve. But the first dataset, resulting from experiment, would be plotted without such line segments. In fact, a marker symbol would be plotted at each of its points.
These examples, and others like them, led us to define a set of seven attributes that define the way a dataset should be plotted. These attributes, which can be set by command-line options, are the following.
Color/monochrome (a choice of one or the other) is the simplest. The choice is toggled with the ‘-C’ option. The `linemode' (i.e., line style) specifies how the line segments joining successive points should be drawn; it is specified with the ‘-m’ option. Linemode #0 means no linemode at all, for example. `Linewidth' means line thickness; it is specified with the ‘-W’ option. `Symbol type' and `symbol size', which are specified with the ‘-S’ option, specify the symbol plotted at each point of the dataset. `Symbol font name' refers to the font from which marker symbols #32 and above, which are taken to be characters rather than geometric symbols, are selected. It is set with the ‘--symbol-font-name’ option, and is relevant only if ‘-S’ is used to request such special marker symbols. Finally, the polygonal line joining the points in a dataset may be filled, to create a filled or shaded polygon. The `fill fraction' is set with the ‘-q’ option. A negative fill fraction means no fill, or transparent; zero means white, and 1.0 means solid, or fully colored.
The preceding seven attributes refer to the way in which datasets are plotted. Datasets may also differ from one another in the way in which they are read from files. The dataset(s) in a file may or may not contain error bars, for example. If a file contains data with error bars, the ‘-I e’ option should occur on the command line before the file name. (The ‘-I’ option specifies the input format for the following files.)
The following illustrates how datasets in three different input files could be plotted simultaneously.
graph -T ps -m 0 -S 3 file1 -C -m 3 file2 -C -W 0.02 file3 > output.ps
The dataset in
file1 will be plotted in linemode #0, so
successive points will not be joined by lines. But symbol #3 (an
asterisk) will be plotted at each point. The dataset in
will be plotted in color, and linemode #3 will be used. In color
plotting, linemode #3 is interpreted as a solid blue line. The second
‘-C’ on the command line turns off color for
points in the third dataset will be joined by a black line with
thickness 0.02, as a fraction of the size (i.e., minimum dimension) of
the graphics display.
The above command line could be made even more complicated by specifying additional options (e.g., ‘-q’ or ‘-I’) before each file. In fact the command line could also include such standard options as ‘-x’ or ‘-y’, which specify the range of each axis. Such options, which refer to the plot as a whole rather than to individual datasets, should appear before the first file name. For example, you could do
graph -T ps -x 0 1 0.5 -m 0 -S 3 file1 -C -m 3 file2 > output.ps
Note that it is possible to include the special file name ‘-’,
which refers to standard input, on the command line. So you may pipe
the output of another program into
graph. You may even generate
a plot in part from piped output, and in part from files.
Each input file may include more than one dataset. If so, the command line options preceding a file on the command line will take effect for all datasets in that file. There are two exceptions to this. By default, the linemode is incremented (`bumped') from one dataset to the next. This feature is usually quite convenient. For example, if you do
graph -T ps -m 3 file1 > output.ps
the first dataset in
file1 will appear in linemode #3, the second
in linemode #4, etc. In fact, if you do
graph -T ps file1 file2 ... > output.ps
without specifying linemode explicitly, the successive datasets read from the files on the command line will appear in linemode #1, linemode #2, .... If you do not like this feature, you may turn it off, or in general toggle it, by using the ‘-B’ option.
You may also control manually the linemode and symbol type used for the datasets within any file. You would do this by including directives in the file itself, rather than on the command line. For example, if the line
appeared in an ASCII-format input file, it would be interpreted as a
directive to switch to linemode #−5 and symbol type #10 for the
following dataset. Future releases of
graph may provide the
ability to set each of the seven dataset attributes in this way.