Set datafile missing

Syntax:
     set datafile missing "<string>"
     set datafile missing NaN
     show datafile missing
     unset datafile

The set datafile missing command tells gnuplot there is a special string used in input data files to denote a missing data entry. There is no default character for missing. Gnuplot makes a distinction between missing data and invalid data (e.g. "NaN", 1/0.). For example invalid data causes a gap in a line drawn through sequential data points; missing data does not.

Non-numeric characters found in a numeric field will usually be interpreted as invalid rather than as a missing data point unless they happen to match the missing string.

Conversely set datafile missing NaN causes all data or expressions evaluating to not-a-number (NaN) to be treated as missing data.

The example below shows differences between gnuplot version 4 and version 5. Example:

     set style data linespoints
     plot '-' title "(a)"
        1 10
        2 20
        3 ?
        4 40
        5 50
        e
     set datafile missing "?"
     plot '-' title "(b)"
        1 10
        2 20
        3 ?
        4 40
        5 50
        e
     plot '-' using 1:2 title "(c)"
        1 10
        2 20
        3 NaN
        4 40
        5 50
        e
     plot '-' using 1:($2) title "(d)"
        1 10
        2 20
        3 NaN
        4 40
        5 50
        e

Plot (a) differs in gnuplot 4 and gnuplot 5 because the third line contains only one valid number. Version 4 switched to a single-datum-on-a-line convention that the line number is "x" and the datum is "y", erroneously placing the point at(2,3).

Both the old and new gnuplot versions handle the same data correctly if the '?' character is designated as a marker for missing data (b).

Old gnuplot versions handled NaN differently depending of the form of the using clause, as shown in plots (c) and (d). Gnuplot now handles NaN the same whether the input column was specified as N or ($N). See also the http://www.gnuplot.info/demo/mgr.htmlimageNaN demo.

Similarly gnuplot 5.4 will notice the missing value flag in column N whether the plot command specifies using N or using ($N) or using (func($N)). However if the "missing" value is encountered during evaluation of some more complicated expression, e.g. using (column(strcol(1)), it may evaluate to NaN and be treated as invalid data rather than as a missing data point. If you nevertheless want to treat this as missing data, use the command set datafile missing NaN.