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| Rule | Behaviour |
|---|---|
| Columns | separated 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 line | ends a block: plotted lines are broken there |
| Two blank lines | end a dataset, selected with index N (0-based) |
?, words, empty cells | no 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, inf | numbers, undefined: a gap that breaks the line |
| Numbers | read 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 rows | a plain column beyond the row skips the point, as a cell with no number |
| Column 0 | the number of the point among those plotted in its dataset, from 0 (after every, as gnuplot) |
every I:J:K:L:M:N | points 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:
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 datafileiteration,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 quotesEvery 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):
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, # commentsWithout 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:
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| Form | Read as |
|---|---|
binary alone, binary matrix | gnuplot'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=N | N records; record=N1:N2:... the records one after the other, one curve (gnuplot's) |
skip=N | N header bytes skipped |
endian=little|big|default|swap | the 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:
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)
enddoA 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.