Search code examples
gnuplot

How to fix GNUPLOT replot issue


I set-up a multiplot like this:

set terminal wxt size 1500,900
set format x "%d%m%y %H:%M:%S"
set xdata time
set timefmt x "%Y%m%dT%H%M%S"
set key font ",6"
set lmargin 10
set rmargin 10
set multiplot layout 2,1
plot "output.txt" u 1:2 w lines axes x1y1, \
"output.txt" u 1:3 w lines axes x1y2
plot "output.txt" u 1:40 w lines axes x1y1, \
"output.txt" u 1:39 w lines axes x1y2
set y2tics border
unset multiplot

Which works, and gives me 2 plots, one above the other.

But pressing the "replot" button (or using zoom) causes the second plot to fill the window - completely hiding the first plot.


Solution

  • Yes, that's how replot behaves. The documentation says: „Note that in multiplot mode, replot can only reproduce the most recent component plot, not the full set.“.

    So, what you can do is to put the whole set multiplot ... unset multiplot stuff in an external file, load it, and then load it again. Or put that stuff in a string and eval it several times.