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.
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(...);
.
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:
'#'
which may occur
anywhere in the header.
Everything beginning with #
to the next end-of-line is
ignored.
TITLE
which must be followed by a
quoted string. Three quoting styles are available: double quotes:
"..."
, forward single quotes: '...'
, and
backward single quotes: `...`
. The quoted string may
not extend across line boundaries.
SURF
or
CURVE
or TUBE
.
SURF
must be followed by a pair of integers indicating
the row and column sizes in surface's grid.
CURVE
and TUBE
must be followed an integer
indicating the number of data points along the axis of the curve
or tube.
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 znThe 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.
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