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

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

[Octave-bug-tracker] [bug #48141] legend disappears after axes command


From: Rik
Subject: [Octave-bug-tracker] [bug #48141] legend disappears after axes command
Date: Mon, 6 Jun 2016 16:58:50 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #4, bug #48141 (project octave):

See the docstring for the axes() command


Called with a single axes handle argument HAX, the function makes
HAX the current axis.  It also restacks the axes in the
corresponding figure so that HAX is the first entry in the list of
children.  This causes HAX to be displayed on top of any other axes
objects (Z-order stacking).


The issue is that legend objects are made from axes objects, even though they
really aren't axes.  When you ask for gca to be the topmost axes object this
causes the legend axes object to be hidden.

Can you test this code under Matlab and then upload the diary file?


diary on
close all
hf = figure (1);
plot(randn(10,1))
hc1 = allchild (hf)
get (hc1, 'type')
hl = legend ('a')
hc2 = allchild (hf)
get (hc2, 'type')
axes(gca) ;
hc3 = allchild (hf)
get (hc3, 'type')
diary off


One simple fix would be to check for any legend object and make sure it stays
on top.  If you look at axes.m you can see that we already do this for
annotation objects


    ## If there is an annotation axes currently on top of the figure
    ## children stack, we will put it back on top




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48141>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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