Gnuplot is interpolating missing data
Dave Horsfall <[email protected]> Mon, 19 Dec 2022 08:27:31 +1100 (EST)
| Newsgroups | gmane.comp.graphics.gnuplot.user |
|---|---|
| Message-ID | <[email protected]> |
Gnuplot 5.4.3 on old MacBook Pro running High Sierra. I have many graphs which have missing data e.g. I was too lazy to record it on that day etc; these are indicated with "x" in the data file. Now, hie thee to http://www.horsfall.org/bike.pdf which is a graph of the progress (if any) that I am making on my exercise bike; the "brake" is the friction adjustment and does not seem to be in any particular unit. For laughs I compute an overall "effort" value which is the product of the distance and the brake (I was forced to rescale it by taking the square root to both make it fit and to make it look better, but that's irrelevant here). Notice how the recorded data is interpolated over the missing data, yet the computed plot shows a gap (the desired behaviour). (I do not use `set datafile missing "x"' anywhere) Oddly enough my other graphs such as www.horsfall.org/health.pdf etc are fine; the only difference is the linetype where I am using "lt rgb" and no "pt", whereas with my exercise bike I am using a specific point type to be compatible with both a colour inkjet and a mono laser. Is this expected behaviour? It looks like a bug to me... Attached are the relevant *.dat and *.gp files. Thanks. -- Dave _______________________________________________ gnuplot-info mailing list [email protected] Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
bike.dat
(text/plain, 1.4 KB)
# # Exercise bicycle readings # # Date Dist Brake 18/10/22 1.0 2 # Take it easy at first... 19/10/22 1.0 2 20/10/22 1.0 2 21/10/22 1.0 2 22/10/22 1.0 2 23/10/22 1.0 2 24/10/22 1.0 2 25/10/22 1.0 3 # Now bump up brake on Mondays 26/10/22 1.0 3 27/10/22 1.0 3 28/10/22 1.0 3 29/10/22 1.0 3 30/10/22 1.0 3 31/10/22 1.0 4 1/11/22 1.0 4 2/11/22 1.0 4 3/11/22 1.0 4 4/11/22 1.0 4 5/11/22 1.0 4 6/11/22 1.0 4 7/11/22 1.5 4 # Bump up distance now... 8/11/22 1.5 4 9/11/22 1.5 4 10/11/22 1.5 4 11/11/22 1.5 4 12/11/22 1.5 4 13/11/22 1.5 4 14/11/22 2.0 3 # Ditto, but wind back the brake 15/11/22 2.0 3 16/11/22 2.0 3 17/11/22 2.0 3 18/11/22 2.0 3 19/11/22 2.0 3 20/11/22 2.0 3 21/11/22 3.5 3 # What was I thinking? 22/11/22 3.5 3 23/11/22 2.5 3 # Back to normal 24/11/22 2.5 3 25/11/22 2.5 3 26/11/22 x x # Too lazy after a big meal... 27/11/22 2.3 3 28/11/22 3.0 3 # Notch up on Mondays 29/11/22 3.0 3 30/11/22 3.0 3 1/12/22 x x # Painful toothache... 2/12/22 3.0 3 # Better now 3/12/22 x x # Too lazy... 4/12/22 3.0 3 5/12/22 3.0 4 # Another Monday, another notch 6/12/22 3.0 4 7/12/22 3.0 4 8/12/22 x x # Lazy... 9/12/22 x x 10/12/22 3.0 4 11/12/22 3.0 4 12/12/22 3.5 4 # Up the distance this time 13/12/22 x x # Had a headache :-( 14/12/22 3.5 4 15/12/22 3.5 4 16/12/22 3.5 4 17/12/22 x x 18/12/22 3.5 4
bike.gp
(text/plain, 1.6 KB)
#
# Daily exercise bike data.
#
reset
set title "Daily exercise bike readings\n(taken every evening)"
set terminal aqua title 'bike'
# set timestamp
set key reverse Left # Looks a bit better
set key box outside
set key below # Still fiddling... Now looks OK.
set xdata time
set timefmt "%d/%m/%y"
set xtics format "%d %b\n%Y"
set xtics nomirror
set y2tics # XXX Wot does this do?
# Try shades of grey, or line type?
set ylabel "Dist. (km)"
set y2label "Brake"
# set xrange ["18/10/22":] # When started
set xrange ["13/10/22":] # Look better (start of the week)
set yrange [0:10] # Brake only goes as far as 8...
set y2range [0:10] # Not likely to ride more than 10km...
set grid # Looks prettier
set style data linespoints # Needs to be obvious on a laser printer
# set style data lines
# Yanks can't spell "grey" or "colour"...
set linetype 1 lc rgb "blue" pt 1
set linetype 2 lc rgb "red" pt 2
#set linetype 3 lc rgb "green" pt 3 # Almost invis. on laser
set linetype 3 lc rgb "black" pt 3
datafile = "bike.dat"
#
# Play with scaling (distance * brake) so that it looks "right".
#
# The product (suitably scaled) is a (possibly meaningless) single
# figure of merit; it's evolved a few times...
#
#rescale(a, b) = (a * b)
#rescale(a, b) = (a * b) / 10
rescale(a, b) = sqrt(a * b)
plot \
datafile using 1:2 axes x1y2 lt 1 title "Distance", \
datafile using 1:3 lt 2 title "Brake", \
datafile using 1:(rescale($2, $3)) lt 3 title "√(Distance x Brake)", \
0 lt -1 notitle # Dummy so I can move above around