I have a dat file that is split into multiple blocks, for example as the following one:
# Time (s) x (m)
0.0 0.0
1.0 1.0
2.0 2.0
3.0 3.0
4.0 4.0
5.0 5.0
5.0 10.0
6.0 11.0
7.0 12.0
8.0 13.0
9.0 14.0
10.0 15.0
The following minimal script:
filename = 'test.dat';
set terminal pngcairo size 960, 540 font 'Verdana, 20'
set output "test.png"
unset key
set xlabel "Time (s)"
set ylabel "x (m)"
set grid
set autoscale fix
plot filename u 1:2 w l lw 1.0 lc rgb 'black' notitle
Gnuplot plots two lines, one for each block. However, since the x data are discontinuous between the two blocks, a jump shows up in the plot.
I would like to join these two lines in the output plot, without modifying the data file. Is there a way to do this?
Maybe it can be done by reading the last line of each block and the first one of the next block and plotting a line between such two points, but I am not familiar with any built-in function that can do the job.