Detailed Contents
Introduction
Command Line
File Format
Plot Instructions
Expressions
Curve Fitting
Three-Dimensional Plots
PostScript Files
Appendix: Line Styles
Index
DigiPlot was developed specifically to enable flexible plotting of data from files of a simple format. The basic unit in a plot file is the line. A line may be either a data line, a command line, a plot instruction or a comment line. The first non-white character on a data line must be a digit, decimal point (.), plus (+) or minus (-). Comment lines start with the hash (#) character. Command lines start with an exclamation mark (!) while plot instructions start with an alphabetic character.
Typically a plot file consists of a combination of these different types of line. The different types of line may be interspersed. The base plot file may also call one or more secondary plot files using the R or R3 plot instructions (see section 4 ). The secondary plot files may also contain commands, plot instructions, comments, data and calls to further levels of plot files.
Plot instructions (lines starting with an alphabetic character) determine how the data is to be plotted. The command lines follow the DigImage command file syntax and may be used to manipulate DigImage variables, provide prompts, receive user input, create loop structures and allow conditional plotting. A complete list of the plot instructions may be found in section 4 . A basic introduction to the DigImage command file commands is given in the DigImage Overview. The interaction between these DigImage commands and the plot instructions is explained in later sections.
Comment lines (starting with a #) are ignored, as are blank lines.
Below we give an example of a simple plot file.
# Simple plot of differences C 0 10 -5.0 5 A P 1 X [1 Y [2 - [3 0 0 1 1.1 0 2 2.3 1 0 4 5 4 6.9 -1 2 8 3.4 3.3 9.9 1e-1 1e-2 11 2 4 XT Time YT Difference between values |
The comment on the first line of the file is followed by a plot instruction. A base plot file should always contain a plot instruction before any data lines. Typically this plot instruction will set up the coordinate system for the plot. Here the C plot instruction is used to set up a two-dimensional plot with the x axis ranging from 0 (left) to 10 (right) and the y axis from 5 (bottom) to -5 (top). If this is followed by data lines without any further plot instructions, then the first column of data will be used as the x coordinate and the second as the y coordinate. However, as we shall see shortly, the plot instructions may be used to allow other combinations of columns to be plotted.
The second plot instruction in this file (A) draws the coordinate axes on the monitor while the third (P 1) specifies that the data should be plotted as crosses (x). The next two lines are used to indicate which columns of data are to be used to obtain the coordinates at which the crosses are to be put. The X instruction specifies the data for the x coordinate, and the Y instruction the data for the y coordinate. The data is constructed using the expressions following the instructions. The expression for the x coordinate, [1, indicates that the first column of data is to be used, while the expression for the y coordinate, [2 - [3, indicates that it is the difference between the second and third columns. We can see here the use of a left-hand square bracket to indicate which column is to be used.
More complex expressions may be used to construct the x and y coordinate data from the columns. These expressions may contain column references, constants, DigImage !!n variables and functions. Further details of the expressions are given in section 5 .
These opening plot instructions are followed by eight data lines, each containing three columns of data. Further columns of data could have been included without affecting the final plot as the X and Y instructions ensure only the desired columns are used. It is not necessary to arrange the columns neatly in the file (although it is frequently desirable from the user's point of view to do so), nor is it necessary for all the data lines to contain the same number of data items provided they all contain the columns required by X and Y. Data falling outside the domain specified by the C coordinate system instruction (such as the last data line) will be plotted (in a logical sense), but will not be visible.
The final two lines of this example use the XT
and YT
plot instructions to add titles to the x
and y
axes.
Goto next document (Instructions)
DigImage documentation page
DigImage home page
Stuart Dalziel's home page