bugGNU Octave - Bugs: bug #48141, legend disappears after axes...

 
 

bug #48141: legend disappears after axes command

Submitted by:  Muhali <muhali>
Submitted on:  Mon 06 Jun 2016 11:57:10 AM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.0.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Sat 11 Jun 2016 12:18:04 AM UTC, comment #8:

Okay, I fixed this up and added a BIST test in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/ce0f87bd0509). Closing report.

Rik <rik5>
Project Administrator
Fri 10 Jun 2016 08:42:52 AM UTC, comment #7:

Your questions:

close all
hax1 = axes
plot (1:10, 'b')
legend ('hax1', 'Location', 'northeast'))
hax2 = axes
## Question: is the first plot with an upward sloping line and legend still visible?
## Or has it been replaced by a blank canvas?

There is a blank canvas (ML and O)

plot (10:-1:1, 'r')
legend ('hax2', 'Location', 'northwest')
## Question: Are both plots visible? Are both legends visible?

No, only the second (with legend).

axes (hax1)
## Question: I believe this should return things to the original view.
## Only the first upward sloping line and its legend should be visible

In ML the original plot appears with legend, in Octave without legend.

axes (hax2)
## Question: I believe this should change things back to view #2
## Only one of the legends will be visible which is the red one in NorthWest.

As with hax1, in ML with and in octave without legend.

Muhali <muhali>
Wed 08 Jun 2016 10:05:30 PM UTC, comment #6:

This is slightly more complicated than I thought. I belive only the legend object associated with a particular axes is put on top. Can the original reporter try the following commands and report back, or attach images, of what happens?

Rik <rik5>
Project Administrator
Tue 07 Jun 2016 03:46:43 PM UTC, comment #5:

Thanks. Matlab does just what I was proposing which is to always keep legend objects ahead of regular axes object in the Z stack. I'll see if I can fix this today.

Rik <rik5>
Project Administrator
Mon 06 Jun 2016 04:58:49 PM UTC, comment #4:

See the docstring for the axes() command

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?

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

Rik <rik5>
Project Administrator
Mon 06 Jun 2016 03:39:54 PM UTC, comment #3:

Confirmed, and the only difference I can see in the propeties is that the "children" array of the figure have been swapped so that the gca object is now the first element, while the legend axes handle is the second. After the legend is created, the legend axes handle is the first.

This reverses the order of the children array, and the legend is drawn on top again:

Mike Miller <mtmiller>
Project Administrator
Mon 06 Jun 2016 12:42:40 PM UTC, comment #2:

But the legend still disappears when using qt and fltk (dev branch).

Anonymous
Mon 06 Jun 2016 12:36:20 PM UTC, comment #1:

I see this error in 4.0.2, but it was fixed in the
dev. branch

Anonymous
Mon 06 Jun 2016 11:57:10 AM UTC, original submission:

In the following code

the legend gets hidden behind the plot if one uses OpenGL. Moreover, the final close command returns

error: set: invalid handle (= -14.8376)
error: called from
legend>deletelegend2 at line 1172 column 3
delete at line 60 column 5
closereq at line 42 column 5
close at line 96 column 5
error: invalid handle
error: called from
delete at line 60 column 5
closereq at line 42 column 5
close at line 96 column 5

regardless of what toolkit is used. No errors in ML.

Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #37416:  diary added by muhali (2KiB - application/octet-stream - corresponding diary file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by muhali (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 11 Jun 2016 12:18:04 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 07 Jun 2016 07:12:32 AM UTCmuhaliAttached File-=>Added diary, #37416
    Mon 06 Jun 2016 03:39:54 PM UTCmtmillerStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1