Let's say I have the following gnuplot script called 'tst.gp':
plot '-' using 1:2 with linespoints 1 2 2 3 3 4 4 3 5 2 e pause 100
I run 'gnuplot tst.gp', then I press '+' with the mouse anywhere in the plot window. The plot should zoom around the mouse location, but instead it zooms in around the center of the window. This works correctly for function and non-volatile data plots.
The issue is the logic at the start of zoom_around_mouse() in mouse.c. The code says
int outside = (real_x <= AXIS_DE_LOG_VALUE(FIRST_X_AXIS, axis_array[FIRST_X_AXIS].min)) || (real_x >= AXIS_DE_LOG_VALUE(FIRST_X_AXIS, axis_array[FIRST_X_AXIS].max)) || (real_y <= AXIS_DE_LOG_VALUE(FIRST_Y_AXIS, axis_array[FIRST_Y_AXIS].min)) || (real_y >= AXIS_DE_LOG_VALUE(FIRST_Y_AXIS, axis_array[FIRST_Y_AXIS].max)) || (real_x2 <= AXIS_DE_LOG_VALUE(SECOND_X_AXIS, axis_array[SECOND_X_AXIS].min)) || (real_x2 >= AXIS_DE_LOG_VALUE(SECOND_X_AXIS, axis_array[SECOND_X_AXIS].max)) || (real_y2 <= AXIS_DE_LOG_VALUE(SECOND_Y_AXIS, axis_array[SECOND_Y_AXIS].min)) || (real_y2 >= AXIS_DE_LOG_VALUE(SECOND_Y_AXIS, axis_array[SECOND_Y_AXIS].max));
What happens is that the x2 and y2 axes are uninited (min = -VERYLARGE, max = +VERYLARGE), so we get outside=1, and then we follow the wrong codepath. I don't know how this relates to autoscaling, so maybe simply checking for this exact condition is what we should do.
dima
2014-04-25
I fixed this and related issues. Patch tracker: https://sourceforge.net/p/gnuplot/patches/677/
Ethan Merritt
2014-04-27