Menu

#2857 empty cell in extra column makes data point disappear

None
open-not-a-bug
nobody
2026-02-12
2026-02-12
Anonymous
No

Version 5.4 patchlevel 2 last modified 2021-06-01

Everything is fine when I say

set offsets 1, 1, 1, 1
plot "dbg.dat" w lp

with following data:

1   1   0
2   2   99
3   1   0
4   2   0

However, when I replace the 99 with

  • nothing (empty cell) or
  • 'NA' or
  • '# comment' or
  • '""',

then the data point is ignored.

Moreover, with

set datafile separator '\t'

when all cells in column 3 are empty (i.e. the file has two columns plus trailing tabs), then gnuplot is confused and refuses to plot any data point.
But when I add a comment in column 3 of the first line, then it works again.
Also it does work when I say plot "dbg.dat" u 1:2 w lp explicitly.
I think whatever content is contained in column 3 should not affect a plot that uses only columns 1 and 2.

I started gnuplot with -d, so it can't be due to my .gnuplot file.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2026-02-12

    This has been the behavior back at least as far as version 5.0 (11 years ago). The program assumes a uniform format for the input line, so when it sees 3 or more columns of data in the first line that sets an expectation that subsequent lines will provide the same. Lines will fewer columns are then flagged as containing "missing" data, which is why the point is omitted.

    You demonstrate this by providing only two values on the first line of data.

    Specifying using 1:2 tells the program explicitly that only those two columns are needed.

     
  • Ethan Merritt

    Ethan Merritt - 2026-02-12
    • status: open --> open-not-a-bug
    • Group: -->
    • Priority: -->
     

Log in to post a comment.

MongoDB Logo MongoDB