1

I have a data file with interleaving data rows from different devices.

Now, I'd like to plot data from one devices with linepoints and use this to filter only the device of interest:

plot 'datafile' using (<someCondition> ? $1 : 1/0):2

Now, gnuplot does not connect the points because there is always some invalid data inbetween.

Is it possible to make gnuplot to connect my points?

By the way: This is a Windows machine, so an external sed/awk/whatever command is no option.

sweber
  • 2,916
  • 2
  • 15
  • 22
  • Here is a solution which works certainly for gnuplot>=4.4.0 (March 2010) https://stackoverflow.com/a/54475591/7295599 – theozh Jun 22 '22 at 14:32

1 Answers1

1

Since gnuplot version 5.0.6 you can use set datafile missing NaN to have invalid points treated as missing ones, and drawing with lines or with linespoints simply ignores those points and connects the others

$data <<EOD
12
27
0
23
42
EOD

set multiplot layout 1,2

set title '0.0 invalid'
plot $data using 0:($1 == 0.0 ? 1/0 : $1) with linespoints pt 7 notitle

set title '0.0 invalid but treated as missing'
set datafile missing NaN
replot
unset multiplot

Output with 5.0.6:

enter image description here

Christoph
  • 47,569
  • 8
  • 87
  • 187