octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40686] Incorrect colorbar size after "axis ti


From: Anne Hanna
Subject: [Octave-bug-tracker] [bug #40686] Incorrect colorbar size after "axis tight" or "axis equal"
Date: Sun, 3 Feb 2019 16:15:13 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #12, bug #40686 (project octave):

My understanding is that, right now, Octave is not using the built-in Gnuplot
colorbox tools at all.  There's a point very early on in 
__gnuplot_draw_axes__  where it simply inserts "unset colorbox" into the plot
stream, turning off any colorboxes Gnuplot might create on its own.  Instead,
Octave draws its own colorbar manually as a two-dimensional image (i.e., with
"plot"), much like I did in my Gnuplot test script.  The image data is just
two identical columns of numbers corresponding to the desired color labeling
for the plot, and the palette is set in advance to give the right colors for
each of those numbers.

It's possible (but I don't know enough to decide this) that it might be better
in the long run to change Octave over to using Gnuplot's built-in colorbox,
but I'm a little leery of making a change of that magnitude at my current
level of understanding of the code, as I'm not sure whether it might break
other things.  The problem for me is that there's not really a clearly
specific "this bit draws the colorbar" section in the  __gnuplot_draw_axes__ 
function.  Instead, all "2-d image" type children of the figure we're drawing
are handled in the same way.  Since I don't know if there are other 2-d image
components a figure might have, I'm not sure it's a good idea for me to mess
with this at this stage.

However, in terms of addressing this particular bug rather than the Gnuplot
colorbar as a whole, I suspect that the safest and most correct thing do might
actually be to apply a correction to the code for drawing the _main_ plot of
an "axis equal" figure.  Right now, "set view equal xy(z)" is executed before
the (s)plot command for the main plot, but the aspect ratio lock is never
turned off afterwards and so it goes on to affect _any_ subsequent figure
components.  I would expect that this is not generally an intended behavior,
so inserting "set size nosquare" at the end of the commands for the main plot
might not have as many side effects as trying to change the colorbar plotting
method.

If I am understanding things correctly, a good place to apply this correction
might be to insert the following at line 1748 of  __gnuplot_draw_axes__.m ,
after the plot command for the main plot has been completed:


  ## Prevent "axis equal"/"set view equal xy(z)" from deforming other parts of
the figure
  if (nd == 3 &&
      strcmp (axis_obj.dataaspectratiomode, "manual") &&
      axis_obj.dataaspectratio(1) == axis_obj.dataaspectratio(2))
    fprintf (plot_stream, "set size nosquare;\n");
  endif



(This is the same test that is used to insert the "set view equal" command in
the first place.)

Does this seem logical?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?40686>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]