bugGNU Octave - Bugs: bug #36408, inverted axes with long right...

 
 

bug #36408: inverted axes with long right justified legends

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Sat 05 May 2012 11:12:03 PM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  Ben Abbott <bpabbott>
Originator Name:  Ben Abbott Open/Closed:  Closed
Release:  dev Operating System:  Any

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)

Sat 22 Jun 2013 03:24:32 AM UTC, comment #17: 

I pushed a changetset.

http://hg.savannah.gnu.org/hgweb/octave/rev/286904321282

I'll add a bug report the for subplot problem and then close this one.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 22 Jun 2013 02:29:50 AM UTC, comment #16: 

Just added the png file, and yes it was the subplot example.


Rik <rik5>
Project Administrator
Sat 22 Jun 2013 02:18:52 AM UTC, comment #15: 

Rik, I think you forgot the png?

In any event, I assume the example is the one including subplots?

If you look at the outerposition property for subplots you'll find that the axes on the perimeter of the figure window do not align to the edge of the window.  They are offset by a 0.05 (normalized) margin.  This is a compatibility bug that needs to be fixed in subplot.m ... and when fixed we should add a test to avoid a regression (which has happend at least twice now).

I'll take care of the coding style suggestions and push the changeset.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 22 Jun 2013 01:07:17 AM UTC, comment #14: 

It appears everyone but me is getting to travel, harumph!  OctConf is starting in Milan on Monday and here you are off in Asia.

Anyways, I think the patch goes a long way towards fixing things.  I'm attaching a png that I made using the bug_34608.m script that I had attached earlier to this report.  As you can see, there is still a bit of fine tuning needed.  The actual text of the legend is now being positioned correctly, but the positioning is not taking into account the box surrounding the legend so there are a few pixels worth of overlap that still need addressing.

From a coding style, it appears that the rest of the scripts in the plot directory are using

%!clf;
rather than
%!clf ();

For consistency I would keep up that convention.

Also, when using long line continuations, jwe prefers that the line start with a "verb" rather than a "noun".  I would re-write some sequences as shown below.

extra_offset = unmodified_axes_outerposition(1) + ...
  unmodified_axes_outerposition(3) - ...
  unmodified_axes_position(1) - ...
  unmodified_axes_position(3);

rewrite to

extra_offset = unmodified_axes_outerposition(1) ...
             + unmodified_axes_outerposition(3) ...
             - unmodified_axes_position(1) ...
             - unmodified_axes_position(3);

When making function calls, unless the line is extremely long, it is also standard practice to not use just a 2-space indent but to align to the parenthesis which starts the function call.  I would rewrite

addproperty ("unmodified_axes_position", hlegend, "data", ...
  unmodified_axes_position);

rewrite to

addproperty ("unmodified_axes_position", hlegend, "data", ...
             unmodified_axes_position);

or even to

addproperty ("unmodified_axes_position", hlegend, ...
             "data", unmodified_axes_position);

since this clearly exposes the property/value pair being added.

Hope this helps.  Post again if you want me to review further.

Rik <rik5>
Project Administrator
Fri 21 Jun 2013 01:03:39 PM UTC, comment #13: 

Rik,

If you have a moment please try out the attached chagneset.  If you don't have time, I'll just push it when I get up tomorrow (I'm in Singapore, 12hrs off of New York)

(file #28375)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Fri 21 Jun 2013 05:54:54 AM UTC, comment #12: 

My last comment wasn't even close.  The problem is/was that the original axes position and outerposition properties were not be stored so that they could be used when listeners triggered an update.  I'll prepare a changeset.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Wed 19 Jun 2013 09:48:23 AM UTC, comment #11: 

The "outerposition" property of the parent axes is being modified on the c++ side (its not modified at all in legend.m) ... Perhaps we should be setting the "position" property (we are) and a the "tightinset" (which we are not).

My free time has become sporadic, so I thought it best to add this note so I don't for get about it.  I expect some free time over the weekend.  I'll take a look then.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Wed 30 May 2012 06:31:30 PM UTC, comment #10: 

Ok. I see the same problem for FLTK. I'm using FLTK 1.3 from MacPorts.

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Wed 30 May 2012 02:57:09 PM UTC, comment #9: 

Interestingly, with your patch applied plotting with gnuplot is just fine.  It is only FLTK that has the problem.  Maybe there is an issue with the age of my FLTK libraries?  I'm running 1.1.10.  All I can definitively say is that before changeset 14578 it used to work even with my system.

Maybe Konstatinos, or somebody else on a non-Mac system, can test and see if it is only my system which has the problem.

Rik <rik5>
Project Administrator
Wed 30 May 2012 12:45:47 AM UTC, comment #8: 

Rik,

I've attached the result I get from running your bug_36408 script and then typing "print bpa-dev.png".

My result looks correct, and is different than yours. My tip is 14698:c2411bff11c6 (same as yours).


Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Tue 29 May 2012 10:04:39 PM UTC, comment #7: 

The patch is closer.  The axes are no longer reversed, but the 'location' property is not correct.  The legend is being shown as 'southeast' rather than 'northeastoutside'.

I'm attaching 3 files.

bug_34608.m : The test case
3.4.3.png : A correct plot from running bug_34608 under Octave-3.4.3
dev.png : An incorrect plot from running bug_34608 with development tip 14697:c2411bff11c6 and Ben's changeset applied.

(file #25952,

Rik <rik5>
Project Administrator
Sat 26 May 2012 03:27:05 AM UTC, comment #6: 

I've attached a changeset. Before pushing another bug, would someone run some tests for me?

(file #25923)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Thu 24 May 2012 01:11:35 PM UTC, comment #5: 

I'll take a look

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Thu 24 May 2012 10:10:20 AM UTC, comment #4: 

Hi

I did not made this commit. It was made accidentally with my name.

http://octave.1599824.n4.nabble.com/oppps-pushed-a-change-set-with-wrong-user-name-td4585225.html

Carnë

Carnë Draug <carandraug>
Project Member
Thu 24 May 2012 04:37:42 AM UTC, comment #3: 

Using hg bisect, the problem changeset is shown below

changeset:   14578:f579a94aacaa
user:        Carnë Draug <carandraug+dev@gmail.com>
date:        Tue Apr 24 20:08:35 2012 -0400
summary:     Preserve legend handle when changing properties (Bug # 36259).

Rik <rik5>
Project Administrator
Sun 13 May 2012 08:50:04 PM UTC, comment #2: 

this has to be a relatively recent regression. I cannot reproduce the bug with e.g. an older build of revision 14443:47fba1dc31b8 but I can reproduce it with 14630:9e4ad3f1f291.

Konstantinos Poulios <logari81>
Sat 05 May 2012 11:18:10 PM UTC, comment #1: 

Both gnuplot and fltk produce improper results. However, they are different.

See the attached pdfs.

(file #25795, file #25796)

Ben Abbott <bpabbott>
Project MemberIn charge of this item.
Sat 05 May 2012 11:12:03 PM UTC, original submission:  

A long right justified legend causes the axes to invert horizontally. It appears the estimation of the length of the legend string is off (by about 5x ?).

figure(1)
clf
subplot (3,1,1)
plot (rand (1,4));
legend ({"1"}, "location", 'northeastoutside')
legend ("right");
subplot (3,1,2)
plot (rand (1,4));
legend ({"1234567890"}, "location", 'northeastoutside')
legend ("right");
subplot (3,1,3)
plot (rand (1,4));
legend ({"12345678901234567890"}, "location", 'northeastoutside')
legend ("right");

Ben Abbott <bpabbott>
Project MemberIn charge of this item.

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #28381:  34608.png added by rik5 (34KiB - image/png)
file #28375:  changeset.patch added by bpabbott (16KiB - application/octet-stream)
file #25955:  bpa-dev.png added by bpabbott (35KiB - image/png)
file #25952:  bug_34608.m added by rik5 (342B - text/x-octave)
file #25953:  dev.png added by rik5 (36KiB - image/png)
file #25954:  3.4.3.png added by rik5 (33KiB - image/png)
file #25923:  changeset.patch added by bpabbott (5KiB - application/octet-stream)
file #25795:  gnuplot.pdf added by bpabbott (4KiB - application/pdf)
file #25796:  fltk.pdf added by bpabbott (4KiB - application/pdf)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

     

     

    Follow 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-23 rik5 StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2013-06-22 rik5 Attached File- => Added 34608.png, #28381
    2013-06-21 bpabbott Attached File- => Added changeset.patch, #28375
    2013-06-06 bpabbott StatusPatch Submitted => In Progress
    2012-05-30 bpabbott Attached File- => Added bpa-dev.png, #25955
    2012-05-29 rik5 Attached File- => Added bug_34608.m, #25952
        Attached File- => Added dev.png, #25953
        Attached File- => Added 3.4.3.png, #25954
    2012-05-26 bpabbott Attached File- => Added changeset.patch, #25923
        StatusNone => Patch Submitted
    2012-05-24 bpabbott Assigned toNone => bpabbott
    2012-05-24 rik5 Carbon-Copy- => Added carandraug+dev@gmail.com
    2012-05-05 bpabbott Attached File- => Added gnuplot.pdf, #25795
        Attached File- => Added fltk.pdf, #25796

    Back to the top


    Powered by Savane 3.5