From: Hans-Bernhard B. <br...@ph...> - 2004-06-21 17:20:59
|
On Mon, 14 Jun 2004, Petr Mikulik wrote: > There seems to be again the bug of "y-axis gets reversed" in "set pm3d map" > splots. Now, every 2nd splot zoomed by mouse has reversed y-axis. Can you > please have a look to this? Here's the start of an analysis of this. Brace yourself, for this is really all a rather despicable mess. The core of the problem is that we still have two different possible results of the 'set yrange' command regarding reverted axes: set yrange [10:5] set yrange [5:10] reverse are (nowadays) supposed to do mean the same thing, but in the reality of our code, they don't: gnuplot> set yrange [1:0] [...] (gdb) p axis_array[FIRST_Y_AXIS ] $1 = {autoscale = AUTOSCALE_BOTH, set_autoscale = AUTOSCALE_NONE, range_flags = 2, range_is_reverted = 0 '\0', min = -10, max = 10, set_min = 1, set_max = 0, writeback_min = -10, writeback_max = 10, [...] gnuplot> set yrange [0:1] reverse [...] (gdb) p axis_array[FIRST_Y_AXIS ] $3 = {autoscale = AUTOSCALE_BOTH, set_autoscale = AUTOSCALE_NONE, range_flags = 2, range_is_reverted = 0 '\0', min = -10, max = 10, set_min = 0, set_max = 1, writeback_min = -10, writeback_max = 10, The difference is that variant 1 has set_min=1, set_max = 0, whereas variant 2 has it the opposite way around. Both of them have the RANGE_REVERSE flag set (range_flags == 2). It's this RANGE_REVERSE flag alone that 'set view map' will modify. It doesn't touch any of the axis range endpoints themselves (and it shouldn't). RANGE_REVERSE is then consulted by the CHECK_REVERSE() macro to decide whether to exchange axis->min and axis->max, and set the axis->range_is_reverted flag, which in turn is read by axis_revert_and_unlog_range() to decide whether to exchange axis->min and axis->max *again*. Sounds insane, doesn't it? The error at hand seems to happen because the mouse zoom generates a command as in variant 1, as can be seen in verbose mode. E.g. in a fresh gnuplot session: gnuplot> set view map gnuplot> sp x*y gnuplot> communication commands will be echoed. starting zoom region. set xr[-6.93319487712:6.80166147456]; set yr[7.03235403496:-8.13313499442] zoom region finished. gnuplot> show yr set yrange [ 7.03235 : -8.13313 ] noreverse nowriteback This state was reached by a combination of the 'backward' set yrange issued by the zoom with the action of splot_map_activate(), which flips the RANGE_REVERSE flag off again after 'set yrange' turned it on. I suspect it may take a thorough re-think and rewrite of how 'set view map' works before this is fixed for good. -- Hans-Bernhard Broeker (br...@ph...) Even if all the snow were burnt, ashes would remain. |