Skip to content

Data Files ​

plot reads gnuplot's default text format.

# iteration  continuity  momentum      <- comment line
1  1.0e-1  2.0e-1
2  8.9e-2  ?                           <- no number: the point is skipped
3  7.9e-2  1.6e-1   # trailing comment

4  7.1e-2  1.4e-1                      <- one blank line: new block, the line breaks
5  6.3e-2  1.3e-1


1  5.0e-1  9.0e-1                      <- two blank lines: new dataset (index 1)
2  4.0e-1  8.0e-1
RuleBehaviour
Columnsseparated by blanks or tabs
#starts a comment anywhere on a line; comment-only lines are neither data nor separators (set datafile commentschars: other characters)
One blank lineends a block: plotted lines are broken there
Two blank linesend a dataset, selected with index N (0-based)
?, words, empty cellsno number: a point that reads one in a plain column (using 1:2) is skipped, its line goes on to the next point; through an expression (using 1:($2)) it is undefined, a gap that breaks the line, as gnuplot
NaN, infnumbers, undefined: a gap that breaks the line
Numbersread as gnuplot (C strtod): the longest leading number counts, 3abc is 3, 1.2.3 is 1.2, 1d3 is 1; hexadecimal too, 0x10 is 16, and C's hexadecimal reals, 0x1.8p1 is 3; beyond the real range, a gap
"quoted cell"one cell, blanks included; not a number
Short rowsa plain column beyond the row skips the point, as a cell with no number
Column 0the number of the point among those plotted in its dataset, from 0 (after every, as gnuplot)
every I:J:K:L:M:Npoints K to M every I of each block, blocks L to N every J of each dataset, from 0

Values are stored flattened with capacities doubled on growth: a large log costs about one real(R8P) per value.

Separators (CSV) ​

set datafile separator makes other characters separate the cells, as gnuplot:

gnuplot
set datafile separator comma        # CSV; also "," or ";," (any of the characters)
set datafile separator tab          # or "\t"
set datafile separator              # back to whitespace, as unset datafile
iteration,residual,cd                  <- a header of words: no numbers, the row is skipped
1, 1.0e-1, 0.52                        <- blanks around cells are ignored
2,8.9e-2,                              <- empty cells, also a trailing one, hold no number
3,"7.9e-2",0.49                        <- a quoted cell is read without its quotes

Every separator ends a cell, so two in a row leave an empty one; separators inside double quotes do not count. Comments, blocks and datasets work as above. A header row is skipped as a row of no numbers (still counted by column 0, as gnuplot counts every row) until an item uses the headers: using 1:"residual", title columnhead or set key autotitle columnhead make the first row of each dataset a header, no longer a point (see Column headers).

Missing data and comments ​

set datafile missing names the string marking missing data, as gnuplot: a point that reads such a cell, in a plain column or through an expression (using 1:($2*1e3)), is left out and its line goes on to the next point; the same string in a column the item does not use changes nothing. set datafile commentschars sets the characters that start a comment, on a line of their own or after the data (# by default):

gnuplot
set datafile missing "-"          # a sensor that reports "-" when it has no value
set datafile missing NaN          # NaN cells left out too, instead of breaking the line
set datafile commentschars "#%"   # # and % start comments
unset datafile                    # whitespace, no missing string, # comments

Without a missing string, a cell with no number (?, -, a word) is skipped in a plain column, as above, but undefined through an expression; the missing string is skipped both ways. NaN stays a gap that breaks the line unless it is the missing string.

Binary files ​

plot and splot read gnuplot 6.0's binary files with binary:

gnuplot
splot 'surface.bin' binary                                # gnuplot's matrix binary
plot 'log.bin' binary format='%int32%float64' using 1:2   # records of an int32 and a float64
plot 'log.bin' binary format='%*int32%float64' using 1    # the int32 skipped, x the record number
plot 'raw.bin' binary skip=64 record=1000 endian=big format='%float' using 1
FormRead as
binary alone, binary matrixgnuplot's matrix binary: float32 values, the first the number N of columns, then the N x of the columns, then rows of their y and N values, to the end of the file; read as a nonuniform matrix (3D plots) (a splot lists its rows last first, as gnuplot's)
format='%type...'records of the format's fields, to the end of the file: %char, %uchar, %short, %ushort, %int, %uint, %long, %ulong, %float, %double and the sized %int8 ... %uint64, %float32, %float64 (and gnuplot's short names: %f, %lf, %d, %i, %u, %c, %byte, %word, ...); %*type reads a field and drops it; a single specifier is every field's, as many as the using reads (floats without a format)
record=NN records; record=N1:N2:... the records one after the other, one curve (gnuplot's)
skip=NN header bytes skipped
endian=little|big|default|swapthe byte order (default the machine's, little; swap the other one)
array=(W,H)a W x H data array, its pixel coordinates generated (array=W: x alone, using 1 the y): Images and palettes
perpendicular=(PX,PY,PZ)splot: the image turned out of the xy plane, its normal along the vector (gnuplot's): Images and palettes

The records read as the columns of a text file: using 1:2 takes the first two fields, using 1 puts them against the record number (column 0), expressions and every work as on text. set table writes them as gnuplot does.

Monitoring logs ​

A solver that appends one line per iteration and flushes it is all --watch needs:

fortran
open(newunit=log_unit, file='residuals.dat', status='replace', action='write')
write(log_unit, '(A)') '# iteration  continuity  momentum'
do it = 1, max_it
   ! ... solve ...
   write(log_unit, '(I0,2(1X,ES14.6E3))') it, res_rho, res_mom
   flush(log_unit)
enddo

A cycle can read the last line while the solver is still writing it: a truncated cell holds no number, or a wrong one (7.9 read from a half-written 7.95e-2). The completed line changes the file size again, so the next cycle redraws it correctly.

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.