SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search Dataplot Pages

DATAPLOT Language Features

Introduction DATAPLOT is an interactive high-level (free-format English-like syntax) language with extensive capabilities in:
  1. Graphics
  2. Fitting
  3. General Data Analysis
  4. Mathematics
Specific Features Specific features of the Dataplot language include:
  1. Programming with DATAPLOT
  2. English-Syntax Language
  3. Free-Format Language
  4. Declaration-Free Language
  5. Structured Language
  6. Punctuation
  7. Language Components
Programming With DATAPLOT
Sequential and Structured 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.
Low Level Commands 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.
High Level Commands 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.
Dataplot Programs Typically Short 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 are Format Free 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 to the terminal screen or to an external file.
Several Hundred Commands 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).
Three Most Important 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.
Spaces are the Universal Separator in Dataplot 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
rather than
English-Synatax Language
Commands Have English Language Names DATAPLOT is an English-syntax language. Many of the command statements are identical to their English-language counterparts. For example,
Examples of English Like Syntax Thus to generate a plot of the function sin(x)/x for the values starting with x = 0.1, at increments of 0.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 perform 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 the natural logarithm of X in a new variable Y, one enters
    LET Y = LOG(X)
Dataplot Programs Easy to Write 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.
Free-Format Language
Columns 1 to 80 Command statements appear free-format in columns 1 to 80 of a program line.
Space Used as Separator Between Command Components 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 0.1, and ending with x = +3, the following is incorrect:
while the following is correct:
    PLOT X**2 FOR X = -3 0.1 3
Note the spacing between PLOT, X**2, FOR, X, -3, 0.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 Permitted in Functions 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.
One Continuation Line Allowed 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 two full lines (160 characters) are not permitted.
Declaration-Free Language
Supported Types in Dataplot The data types supported in the Dataplot language are
  • parameters = named onstants
  • variables = named vectors
  • matrices = named matrices
  • functions = named character strings
Rules for Names Names used for parameters, variables, matrices, and functions can be up to eight 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 eight characters are scanned and internal1y stored.
Declaration Free Language DATAPLOT is a declaration-free language. One need not pre-define parameter, variable, matrix, 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.
DELETE First to Change Type Once a name is defined (as a parameter, a variable, a matrix, or a function), it remains that type throughout the DATAPLOT run. 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 using the DELETE command (as in DELETE X), and then reuse the name in the desired fashion.
Structured Language
Program Execution Flows from Top to Bottom 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.
Subprograms Initiated with CALL Command Branching within a (sub)program is not permitted; branching between subprograms can be done via the CALL command, as in
where ANALYSIS. is the name of the (analyst-created) file where the subprogram resides. The period at the end of the file name identifies ANALYSIS as a file name as opposed to, for example, the name of a parameter, variable, or function.
Spaces are Universal Separator in Dataplot 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 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(-ALPHA + BETA*X)
Command Statements are Free Format 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.
No Punctuation in Data Files 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).
Restricting Rows and Columns When Reading Data Files Alphabetic information at the beginning of a data file can be skipped over using the SKIP command. For example,
    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
which would be a way of omitting non-numeric (or numeric) information beyond column 50.
Main Menu
Components of the Dataplot Language The DATAPLOT language consists of the following components:
  1. commands;
  2. arithmetic operators;
  3. relational operators;
  4. numbers;
  5. parameters;
  6. variables;
  7. functions;
  8. sub-commands under the LET command;
  9. keywords;
  10. in-line text sub-commands;
  11. file references.

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 06/05/2001
Last updated: 09/20/2016

Please email comments on this WWW page to