Do not use the
replot command, use the comma instead
Since in your script I see no apparent reasons to need the use the
replot command, I suggest to use directly the comma
, to separate the two curve to be plotted:
plot sin(x), cos(x) for example.
Take it as a good habit but it is more, it is different in principle (see below).
You may find interesting to put
\ as last character to split a single line (note that it requires that there are not blank spaces or other characters after). It makes the script more clean.
set style data linespoint # To avoid to repeat it on each line of plot command
# Note below no spaces after the `\`
plot "<(sed -n '2,6p' sandbox_gp_pure.data)" using 3:4 \
, "<(sed -n '7,11p' sandbox_gp_pure.data)" using 3:4
replot command instead you plot again each curve already present on the graphic (rereading the data and performing again all the following operations) and only after you plot the new curve.
It is a good habit because using again your script tomorrow, you can have a general slow down of your work process when the files are many, huge or on a remote filesystem; when you perform long operations to process the data; when the points effectively plotted are many and you need to wait the graphical update of the window even more if you are working through an
ssh -X connection...
Moreover in terminal as
set terminal pdfcairo; set output 'my.pdf' ;
set output ; set terminal qt # or whatever is your default terminal
you will obtain a 2 pages document, and a huger pdf file.
Note: You can use the
every keyword without need to create subshells
() and call external programs such as
sed. If you cannot pre-order them with a sort, you can add
smooth unique to plot the dataset with the
linespoints style that loves entries ordered by the
plot "sandbox_gp_pure.data" every ::1::5 us 3:4 t "set 1" w linesp \
, '' every ::6::10 us 3:4 t "set 2" w linesp
Or if you want them ordered
plot "sandbox_gp_pure.data" every ::1::5 u 3:4 smooth unique t "set 1" w linesp\
, '' every ::6::10 u 3:4 smooth unique t "set 2" w linesp
Another advantage is the portability. It will work even where
sed is not installed and should work even under Windows.
You can notice the shift in the line-number it's because it starts from
The first datum in each block is numbered '0', as is the first block in the
help replot output:
replot command without arguments repeats the last
command. This can be useful for viewing a plot with different
or when generating the same plot for several devices.
Arguments specified after a
replot command will be added onto the last
splot command (with an implied ',' separator) before it is