DATAPLOT Language Features
DATAPLOT is an interactive high-level (free-format English-like
syntax) language with extensive capabilities in:
- Graphics
- Fitting
- General Data Analysis
- Mathematics
- Programming with DATAPLOT
- English-Syntax Language
- Free-Format Language
- Declaration-Free Language
- Structured Language
- Punctuation
- Language Components
Programming With DATAPLOT
DATAPLOT programs proceed sequentially from the
beginning of the code to the end. The language is
structured. There are no "Go-To"-type statements
and no statement labels.
Like BASIC, FORTRAN, etc., DATAPLOT has a series
of low-level commands which specify to the
computer that certain elementary operations (such
as readinq, writing, looping, etc.) should be carried out.
In addition, hovever, DATAPLOT goes beyond BASIC
and FORTRAN in that it allows the analyst to also
make use of a set of high-level commands (such as
PLOT, FIT, HISTOGRAM, etc.) which permit the
analyst to carry out a wide variety of graphics
(continuous or discrete), non-linear fitting, data
analysis, and mathematical operations directly.
Like BASIC, DATAPLOT is an interpretive language.
Although tbe language can be used in a
semi-interactive mode (running pre-stored programs
at a terminal), and a batch mode (running
pre-stored programs with remote output on the
batch high-speed printer), it was primarily
designed for (and is most effectively used in) an
interactive environment.
Because of the existence of commonly-used
high-level graphical and analytical capabilities,
the typical DATAPLOT program is short (e.g., 5 to
20 lines). Usually there is only a main
program with no need of subprograms. If
subprograms are desired, they are accessed via the
CALL command.
Input and output in DATAPLOT is format-free. The
READ and
SERIAL READ
command enter data into
DATAPLOT, the
WRITE
(with PRINT as a synonyn)
command allows the writing of data (back to the
terminal screen or out to a file).
The DATAPLOT command vocabulary consists of
several hundred commands. The analyst may use any
command at any time. A given program for a
given application typically makes use of a small
subset of DATAPLOT commands (10 to 15 commands).
The 3 most important DATAPLOT commands are
PLOT,
FIT, and
LET. Other
commonly-used commands are
CHARACTERS,
LINES,
TITLE,
...LABEL (as in YLABEL,
X1ABEL, X2LABEL, and X3LABEL),
FONT,
TEXT,
ECHO,
READ,
WRITE, and
STATUS.
The universal separator between words on a
DATAPLOT command line is a blank (1 or more
blanks). The comma is never used in any DATAPLOT
command syntax; when in doubt, use a blank rather
than a comma, as in
WRITE A B C
rather than
WRITE A,B,C
Main Menu
English-Synatax Language
DATAPLOT is an English-syntax language. Many of
the command statements are identical to their
English-language counterparts, for example,
PLOT
FIT
HISTOGRAM
NORMAL PROBABILITY PLOT
ANOVA
SMOOTH
BOX PLOT
Thus to generate a plot of the function sin(x)/x
for the values starting with x = .1, at increments
of .2, and ending vith x = 12, one would enter
PLOT SIN(X)/X FOR X = .1 .1 12
And if the analyst has data in variables Y and X
and wishes to carry out a least squares fit of Y
on X vith the model y = a+b*exp(-c*x), one would enter
FIT Y = A+B*EXP(-C*X)
And if the analyst has data in the variable X and
wishes to form a new variable Y defined as the
natural logarithm of Y, one enters
LET Y = LOG(X)
The net result is that DATAPLOT programs are easy
to write, easy to understand, and easy to update.
This is particularly important for the analyst
with no prior programming experience.
Main Menu
Free-Format Language
Command statements appear free-format in columns 1
to 80 of a program line.
The usual separator between components of a
command line is a blank (one or more blanks). Thus
to generate a plot of X**2 over the interva1 of x
values starting with x = -3, at increments of .1,
and ending with x = +3, the following is incorrect--
PLOTX**2FORX=-3.13
while the following is correct--
PLOT X**2 FOR X = -3 .1 3
Note the spacing between PLOT, X**2, FOR, X, -3,
.1, and 3. The spacing here is 1 blank, but
optionally could have been any number of blanks.
The PLOT statement as given here starts in column
1, but optionally could have been any column.
Packing of characters is permitted only in
defining and using functions. Thus
PLOT 3+2*EXP(-X) FOR X = 0 .1 6
is correct, as is
PLOT 3 + 2 + EXP(-X) FOR X = 0 .1 6
and other variations.
If command statements are longrer than 80
characters, then they may be extended onto the
next line by appending ... at the end of the
first line, as in
PRE-FIT Y = A + B*EXP(-C*X) FOR A = 10 1 20 ...
FOR B = 1 .1 2 FOR C = .5 .01 .6
Command statements longer than 2 full lines (160
characters) are not permitted.
Main Menu
Declaration-Free Language
The elements of the DATAPLOT language which the
analyst may create, redefine, and operate on are
- parameters = named onstants
- variables = named vectors
- functions = named character strings
Names used for parameters/variables/functions can
be up to 8 characters, must start with an
alphabetic character, and may thereafter be any
combination of the 26 alphabetic characters and
the 10 numeric characters. Names which are
longer than 8 characters can be used but
only the first 8 characters are scanned and
internal1y stored.
DATAPLOT is a declaration-free language – one need
not pre-define parameter, variable, and function
names in a separate section unto itself (as with
ALGOL and PASCAL); in fact, one does not
pre-define such elements at all-- one simply
introduces these elements along the way as needed
by the program and as dictated by the analysis.
Once a name is defined (as a parameter, a
variable, or a function), it remains that type
throughout the DATAPLOT run (thus, for exanple, if
X is used as a variable, it will remain a variable
for the entire run). If the analyst chooses to
change the use of a name (for example, to change a
variable X to a function X) in the middle of a
run, then the analyst must first delete the name
(via the DELETE
command, as in DELETE X), and then
reuse the name in the desired fashion.
Main Menu
Structured Language
Program execution--whether in the main routine
or within a subprogram)--always flows from top to
bottom, and so DATAPLOT is by design a
structured language. DATAPLOT does not have
statement labels and therefore is a
"GO-TO-less" language. In practice, because of
the existence of higher-level graphics/analysis
commnands, and because of the DATAPLOT feature of
being able to append subset and conditionality
qualifiers at the end of any high-level graphics
and analysis command, the need for such branching
has been virtually eliminated. The net result is
a structured, top-to-bottom language structure
which greatly facilitates the writing and updating
of programs.
Branching within a (sub)program is not permitted;
branching between subprograms can be done via the
CALL command, as in
CALL ANALYSIS.
where ANALYSIS. is the name of the
(analyst-created) file where the subprogram
resides (the period at the end of the file name
tells DATAPLOT that ANALYSIS is the name of a
storage file name as opposed to, for example, the
name of a parameter, variable, or function).
Main Menu
Punctuation
The universal separator for components in a
DATAPLOT command line is the space (= blank). A
blank between the words of a command line are
important because DATAPLOT uses such spaces as a
separator. Spaces around relational operators
(e.g., =, <, <=, etc.), arithmetic operators (+, -,
*, and **), and within arithmetic
expressions (e.g., B**2-4*A*C) may be included or
excluded at the preference of the analyst.
Readability considerations suggest that spaces be
included around such operators and in such expressions.
Commas serve no purpose in DATAPLOT and may at
times be the cause of syntax errors. There are no
commands which call for the use of commas in
DATAPLOT; vhen in doubt, leave a space rather
than a comma. Blanks and spaces within
mathematica1 and functional expressions are solely
for visual convenience--they may be included or
excluded at the discretion of the analyst; as in
LET Y = A+B*EXP(-ALPBA+BETA*X)
LET Y = A + B*EXP(-ALPHA + BETA*X)
Command statements appear free-format in columns 1
to 80 of a program line. If a statement is longer
than this, it may be continued onto the next line
by appending a ... at the end of the first line.
Statements longer than 2 full lines (160 characters)
are not permitted.
DATAPLOT also expects no punctuation in data files
which are read via the READ and SERIAL READ
commands. Adjacent numbers on a line image may be
free-format but should be separated by at least
one blank. Commas between numbers will be
ignored by DATAPLOT. DATAPLOT also converts non-printing
characters (e.g., tab characters) in command lines and
data files to spaces (this is not true in earlier versions
of DATAPLOT).
Alphabetic information up at the
beginning of a data file can be skipped over via
the SKIP command, as in
SKIP 5
which will cause subsequent READ and SERLAL READ
commands to skip over all information on line
images 1 to 5 of the file. The ROW LIMITS command
allows the analyst to focus only on specified line
images of a file, as in
ROW LIMITS 6 100
The COLUMN LIMITS command allows the analyst to
focus only on certain column limits in reading a
file, as in
COLUMN LIMITS 1 50
which would be a way of omitting non-numeric (or
numeric) information beyond column 50.
Main Menu
Language Components
The DATAPLOT language consists of the following componenes:
- commands;
- arithmetic operators;
- relational operators;
- numbers;
- parameters;
- variables;
- functions;
- sub-commands under the LET command;
- keywords;
- in-line text sub-commands;
- file references.
Main Menu