Plotting pre-computed data

The dataplot() command plots the graph of numeric data read from a file. It produces graphs in same style as that of the plot3d(), spacecurve(), and tubeplot() plotting commands.

The dataplot() command

    dataplot(file, options);

       file: name of the file containing numerical data

Numerous optional arguments can modify the default appearance of the displayed graphs. These are described in Plotting Options.

Remark 1: The file argument is a dynagraph string and must be quoted if necessary. See the section on Quoted Strings for details.

Remark 2: plotdata() is provided as a synonym to dataplot().

A graph drawn by dataplot() can be assigned to a name like all other plotting commands, as in p1 := dataplot(...);.

The contents of the data file

All whitespace (spaces, tabs, newlines) between individual tokens in the datafile are ignored. Thus is it acceptable, though not necessarily a good thing, that datafile consist in its entirety of just one very long line.

The data file must contain the following:

  1. a header segment consisting of:
  2. a data segment consisting of a sequence of coordinate triples. Each coordinate triple consists of a sequence of three floating point numbers and describes one point on the surface or on the curve. No comments or punctuation are allowed in the data section, otherwise the formatting is free, as in the header section.
  3. any number of repetitions of the header/data segment pairs described in 1 and 2. Each pair describes a graph. The dataplot() command will display all graphs simultaneously.

In summary, the general format of a surface description is:

    TITLE "An optional title"
    SURF m n
    x11 y11 z11    x12 y12 z12   ...   x1n y1n z1n
    x21 y21 z21    x22 y22 z22   ...   x2n y2n z2n
    ...
    xm1 ym1 zm1    xm2 ym2 zm2   ...   xmn ymn zmn

The general format of a spacecurve description is:

    CURVE n
    x1 y1 z1    x2 y2 z2   ...   xn yn zn
The general format of a tubeplot description is:
    TUBE n
    x1 y1 z1    x2 y2 z2   ...   xn yn zn

A datafile may contain a mix of any number of these three data types.

Remark 3: Each x y z triple in the datafile is interpreted literally as the Cartesian coordinates of a point. Any coords=... option on the command line is ignored.

Sample data files

Example 1:

   # A simple closed curve: paste the following data
   # into a file and plot with dataplot(filename);
   TITLE "a pretty simple curve"
   CURVE 5
   0 0 0
   1 0 0
   0 1 0
   0 0 1
   0 0 0

Example 2: Change CURVE to TUBE in the data file above and plot with

   > dataplot(data,tuberadius=1/5);

Example 3:

   # A surface defined on 3x3 grid.  Plot with
   # dataplot(filename);
   # Also try
   # dataplot(filename, gridstyle=triangular, style=patch);
   SURF 3 3
   0 0 0  0 1 0  0 2 0
   1 0 0  1 1 1  1 2 0
   2 0 0  2 1 0  2 2 0
Back to table of contents