Hi. I have this gnuplot script I call tst.gp:
plot '-' with points, '-' using 1:2:3:4 with vectors
-0.9 -0.9
-0.9 0.9
0.9 -0.9
0.9 0.9
e
1.1 0 0.5 0
e
pause 1000
This plots 4 points in a square, and a single vector. When I generate this plot with an interactive terminal (tried on x11 and qt), I see all of the data. In particular the autoscaling sets the x range [-1:2]. If I "replot", I expect no visible changes to occur. However, I see the autoscaling code set a different x range: [-1:1.5]. This cuts off the head of the vector, and is incorrect. The cause of this is that the replot follows an entirely different code path, which doesn't look at both points in the vector.
The "plot" path that sets the correct range is here:
https://github.com/gnuplot/gnuplot/blob/8a942f0b9880d31ff98a265d3abb39faf2884a22/src/plot2d.c#L1109
The "replot" path uses the refresh_bounds() function instead of get_data(). This is a lot simpler and doesn't include the required logic from get_data(). Any thoughts here? Should these be separate in this way?
I see two issues here. One is definitely a bug and the other maybe also a bug.
1) As noted in the comments in refresh_bounds(), the intent is to leave the axis limits untouched if autoscaling was already active in the original plot. But there is no test in the code that implements this policy. So that is a bug.
2) As you note, the scaling tests in refresh_bounds() are minimal compared to the full set in get_data(). They are intended as a quick approximation to be used only when the original data is no longer available. Before this was added, the program would instead give you a command prompt requesting that the in-line data be typed in again. The approximation is not perfect, but is much less annoying that having to retype the data each time. Does the imperfect approximation rise to the level of a bug? I'm not sure.
If (1) is fixable, then (2) does not matter in your test case although there are other cases where it would still come into play; e.g. plot '-' .... set auto x; refresh
May also have fixed old bug #1440