问题
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.
回答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:
来源:https://stackoverflow.com/questions/46069413/gnuplot-connect-points-even-when-missing-invalid-are-inbetween