bugGNU Octave - Bugs: bug #39697, legend doesn't change position if...

 
 

bug #39697: legend doesn't change position if title block grows

Submitted by:  Rik <rik5>
Submitted on:  Mon 05 Aug 2013 05:06:54 AM UTC  
 
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich 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)

Fri 30 Aug 2013 01:19:42 AM UTC, comment #14:

Rik,

I've been thinking about how legends and colorbars can be handled with the recent changes to the axes position, and outerposition properties.

When a legend/colorbox is added outside the plot box, its outerposition can be modified to make room for the new object. The new legend/colorbar object needs to store the original axes position/outerposition value so that when when deleted the axes properties can be restored to their original values.

I think this will be fairly straight forward to implement, but will not be compatible with what Matlab does. Even so, I think it a good approach.

I thought I mention it while now since I'm not sure when/if I'll have time to work on this, and didn't want to risk forgetiing about it.

Ben Abbott <bpabbott>
Project Member
Thu 29 Aug 2013 10:54:03 PM UTC, comment #13:

Adding bug #33112 which mentions that legend has no listener on axis position.

Rik <rik5>
Project Administrator
Fri 16 Aug 2013 05:17:42 AM UTC, comment #12:

I'm going to re-open the bug report because the original issue, the legend box not shifting when the title grows, is still present. The axes is now correctly updated, but there is no listener in legend.m to detect when the axes position has changed and the legend box need to be re-positioned.

Rik <rik5>
Project Administrator
Thu 15 Aug 2013 11:50:26 PM UTC, comment #11:

I pushed the changeset

http://hg.savannah.gnu.org/hgweb/octave/rev/92effb035b97

Ben Abbott <bpabbott>
Project Member
Thu 15 Aug 2013 11:09:24 PM UTC, comment #10:

I thought rundemos() would be enough, but I was obviously wrong. Well, I would go ahead and commit your changeset since that seems to solve the issue with multi-line titles.

Rik <rik5>
Project Administrator
Thu 15 Aug 2013 09:34:10 PM UTC, comment #9:

Rik, try running tests on graphics.cc. With the initial position updates removed, I get the failure below.

Ben Abbott <bpabbott>
Project Member
Thu 15 Aug 2013 09:14:18 PM UTC, comment #8:

Your patch seems to fix things up. I notice that we are now calling update_position once at the start of sync_positions and again at the end. I tried commenting out the first instance and then running through the plot demos and I couldn't see any difference. Perhaps, we don't need the first call anymore? I'm attaching a diff for this change so you can take a look.

(file #28858)

Rik <rik5>
Project Administrator
Thu 15 Aug 2013 04:12:14 PM UTC, comment #7:

Rik,

I have a simple fix. If you don't notice something I've overlooked, I'll push a changeset.

(file #28855)

Ben Abbott <bpabbott>
Project Member
Thu 15 Aug 2013 01:03:13 AM UTC, comment #6:

Apparently the problem isn't the menubar or statusbar height. Try the following

It appears that the extents of the title are lagging by one update. Which may imply there is an easy fix. Maybe an additional mark_modified () is all that is needed. For example, the commands below render the desired result.

Ben Abbott <bpabbott>
Project Member
Wed 14 Aug 2013 10:01:06 PM UTC, comment #5:

Maybe the 20 pixels is due to the status bar?

Ben Abbott <bpabbott>
Project Member
Wed 14 Aug 2013 09:35:16 PM UTC, comment #4:

I see you're right that the axes position is being shifted to have "two" remain visible. Interestingly, I switched over to pixel for the units and everything looks right if I bring the axes and title text object down by 20 pixels. This could, of course, just be a coincidence. But it might also suggest that we aren't calculating correctly with the menubar height somehow. I did tests with the menubar turned off though and the title is still being clipped.

Rik <rik5>
Project Administrator
Wed 14 Aug 2013 08:50:21 PM UTC, comment #3:

Yeah, there are plenty of short comings for the legend. It really needs to be rewritten from scratch. But before that is done, I hope the updating for the tightinset can be fixed.

The problem with tightinset is that calc_tightbox() doesn't account for changes to the axes fontsize. In addition there are problems with changes to the title, and {x,y,z}labels. However, I don't think the problem is a missing mark_modified ().

If you try the following commands, you'll see that "one" will disappear as it moves above the top of the figure, but that "two" is always visible. So the updating appears to be working. Perhaps the height or position of the title isn't correct?

Ben Abbott <bpabbott>
Project Member
Wed 14 Aug 2013 08:11:35 PM UTC, comment #2:

The axes position not moving is an issue by itself. It seems like we are missing a drawnow() or mark_modified() call after adding the multi-line title. You could file another bug report for that.

But, it doesn't affect this issue which is that there is no listener on the axes position. If I use the mouse on a corner of the plot window to slightly resize it then the axes is re-drawn with the correct size, but nothing fires to also adjust the legend box position.

Incidentally, "fontunits" only determines how "fontsize" will be interpreted. To find the extents for the title you need to operate with the "units" property on the title text object.

Rik <rik5>
Project Administrator
Wed 14 Aug 2013 12:11:55 PM UTC, comment #1:

Rik,

The tightinset support has been improved in the last few weeks. So, I tried your example to see if there was any improvement. The first thing I noticed was that the axes position didn't move. Is that a regression?

Second, it looks to me as if the title's text object's extent isn't being updated properly.

The title's extent appears to indicate the text object is only one line high. Which explains why the tightinset isn't being updated correctly?

Ben Abbott <bpabbott>
Project Member
Mon 05 Aug 2013 05:06:54 AM UTC, original submission:

There isn't a listener on the the position property of the axis. If the axis changes position, such as when the title block grows, the legend is left out of position. This is apparently a known problem. In the code for legend.m I find:

I'm adding a %!demo block to legend.m which shows the problem.

Rik <rik5>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #28858:  graphics2.diff added by rik5 (874B - application/x-download)
file #28855:  graphics.diff added by bpabbott (363B - application/octet-stream)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

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

    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 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 31 Aug 2013 08:17:18 PM UTCbpabbottAssigned tobpabbott=>None
    Thu 29 Aug 2013 10:54:03 PM UTCrik5Dependencies-=>Depends on bugs #33112
    Fri 16 Aug 2013 05:17:42 AM UTCrik5StatusFixed=>Confirmed
      Open/ClosedClosed=>Open
    Thu 15 Aug 2013 11:50:26 PM UTCbpabbottStatusNone=>Fixed
      Assigned toNone=>bpabbott
      Open/ClosedOpen=>Closed
    Thu 15 Aug 2013 09:14:18 PM UTCrik5Attached File-=>Added graphics2.diff, #28858
    Thu 15 Aug 2013 04:12:14 PM UTCbpabbottAttached File-=>Added graphics.diff, #28855
    Mon 05 Aug 2013 05:06:54 AM UTCrik5Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup