bugGNU Octave - Bugs: bug #32343, last plot resets all other curve...

 
 

bug #32343: last plot resets all other curve labels

Submitted by:  Dmitri A. Sergatskov <dasergatskov>
Submitted on:  Thu 03 Feb 2011 09:28:16 PM UTC  
 
Category: Plotting with gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: David Bateman <dbateman>
Originator Name: Dmitri SergatskovOpen/Closed: Closed
Release: devOperating 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)

Sun 06 Feb 2011 07:48:01 PM UTC, comment #14:

I'll file a new bug report.

Ben Abbott <bpabbott>
Project Member
Sun 06 Feb 2011 06:38:59 PM UTC, comment #13:

The patch in David's comment seems to have
fixed this. legend definitely has enough
complicated options to confuse both implementers
and users. We can blame that on Matlab.

So, unless others find more problems, I would
say that we can keep this closed.

Good to have this fixed before the release.
Thanks David!

Michael Godfrey <godfrey>
Project Member
Sun 06 Feb 2011 02:44:21 PM UTC, comment #12:

I see some remaining problems.

I notice that "legend off" does not return the axis position to its original values.

There is also an inconsistency with Matlab.

When the legend's position is "northeastoutside", the axis position adjusts downward and to the left for me. Matlab only adjust to the left. I think the Matlab approach is to align the top of the axes objects.

Should new bug reports be opened?

Ben Abbott <bpabbott>
Project Member
Sun 06 Feb 2011 02:33:54 PM UTC, comment #11:

If fact I don't think this is the same bug and in fact its two separate bugs.. I believe the changeset

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

fixes these issues

D.

David Bateman <dbateman>
Project MemberIn charge of this item.
Sun 06 Feb 2011 02:24:03 PM UTC, comment #10:

I see the same effect as Michael, and have added another demo.

I've also attached a plot.

(file #22609)

Ben Abbott <bpabbott>
Project Member
Sun 06 Feb 2011 08:07:52 AM UTC, comment #9:

The end of my previous commnet got cut off.

It said:
error: called from:
error: /usr/local/share/octave/3.5.0+/m/plot/legend.m at line 396, column 19
octave:2>
=======================================

Same as example 3, but the last command fails. So, there
is something random happening. The may be an initialization
problem.

I recommend reopening this report.

Michael Godfrey <godfrey>
Project Member
Sun 06 Feb 2011 08:05:59 AM UTC, comment #8:

There still appear to be problems with
legend() using fltk. Some commands fail
that should work, and the behavior of commands depends
on previous commands.

Examples:
Example 1:
octave:1> plot(1:200)
octave:2> legend({"hello world"}, "location", "northeastoutside");
octave:3> legend({"hello world"}, "location", "northeastoutside");
octave:4>
===============

Each legend command shrinks the plot to the left.

Example 2:
octave:1> plot(1:200)
octave:2> legend({"hello world"}, "location", "northeastoutside");
octave:3> legend({"hello world"}, "location", "southeastoutside");
error: invalid value for array property "position"
error: called from:
error: /usr/local/share/octave/3.5.0+/m/plot/legend.m at line 640, column 11
octave:3> legend({"hello world"}, "location", "northeastoutside");
octave:4> quit
===============================
Command fails that should be OK. But, following command
works.

Example 3:

octave:1> plot(1:200)
octave:2> legend({"hello world"}, "location", "southeastoutside");
error: invalid value for array property "position"
error: called from:
error: /usr/local/share/octave/3.5.0+/m/plot/legend.m at line 640, column 11
octave:2> legend({"hello world"}, "location", "northeastoutside");
error: get: unknown axes property textposition
1,1 Top

Michael Godfrey <godfrey>
Project Member
Sat 05 Feb 2011 03:47:41 PM UTC, comment #7:

Ok closed
D.

David Bateman <dbateman>
Project MemberIn charge of this item.
Sat 05 Feb 2011 03:25:50 PM UTC, comment #6:

Thanks for looking at this problem. I assumed that the listeners were there for some reason, but it wasn't clear to me what was causing the trouble.

I pushed the change.

OK to close the two bug reports?

John W. Eaton <jwe>
Project Administrator
Fri 04 Feb 2011 10:58:07 PM UTC, comment #5:

John,

The listener functions are needed to allow things like

plot(1:2, "-r")
h = legend("I am red")
set (h, "location", "east")

to work as expected. I believe the issue is rather that in _plt_ we aren't taking into account any existing legends when called. So the fix is to correctly initialize hlgnd and tlgnd in _plt_. Ben's original fix worked for #32022 because he explicitly set the correct axis handle and effectively removed the call to fliplr.

Adding fliplr again works for #32343 because the second call to _plt_ and the embedded second call to the legend function makes the "2" legend key be assigned to the last key set. However this won't work for a case like

plot (1:3,"-r;1;");hold on; plot(2(1:3),"-g;2;",3(1:3),"-r;3;")

as the second and third labels will be reversed. Note that flipud and fliplr shouldn't be needed at all.

I believe the attached changeset fixes this issue, but I haven't pushed it yet.

D.

(file #22608)

David Bateman <dbateman>
Project MemberIn charge of this item.
Fri 04 Feb 2011 08:44:18 PM UTC, comment #4:

Is the updatelegend function even needed? If I remove the addlistener commands for it, the demos all seem to work, and the problem reported here goes away. See the attached diff for my changes. Can someone give me an example where the updatelegend listener is needed?

David, will you please comment on this problem?

(file #22607)

John W. Eaton <jwe>
Project Administrator
Fri 04 Feb 2011 12:34:53 AM UTC, comment #3:

Ouch!

I don't recall the details, but I think this originally came about after David's work on the legend. I thought my attempt had worked, but apparently not.

I've cc'd David in case he has something more useful to add than I.

Ben Abbott <bpabbott>
Project Member
Thu 03 Feb 2011 10:52:52 PM UTC, comment #2:

The bug was introduced in this changeset when another bug was fixed:

http://hg.savannah.gnu.org/hgweb/octave/rev/1f54ee6760b5

I'm copying Ben since he made the change.

the change was simple, just

in legend.m. I'm not sure why flipud is used here since my tests show that hplots is a row vector, so flipud has no effect.

If I go back to fliplr, then the bug reported here (#32343) is fixed, but the bug reported in #32022 reappears.

I don't know what the proper fix is.

John W. Eaton <jwe>
Project Administrator
Thu 03 Feb 2011 09:47:22 PM UTC, comment #1:

Since it works in 3.3.54 but not in 3.3.55, I'm bisecting to see what change caused the problem. Once I've determined that, maybe it will be easy to fix. If not, I'll ask for help on the maintainers list.

John W. Eaton <jwe>
Project Administrator
Thu 03 Feb 2011 09:28:16 PM UTC, original submission:

In 3.3.91 the following code

octave:1> plot(1:3, "-r;1;")
octave:2> hold on
octave:3> plot(2*(1:3), "-b;2;")

labels both curves as "2".

The code worked correctly in 3.3.54 and 3.2.4.

See also:

http://octave.1599824.n4.nabble.com/curve-key-in-3-3-91-td3258672.html

Dmitri.
p.s. There is no "3.3.91" tag in "Release field"...

Dmitri A. Sergatskov <dasergatskov>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #22609:  demo_legend_18.pdf added by bpabbott (5KiB - application/pdf)
file #22608:  patch.legend added by dbateman (9KiB - application/octet-stream)
file #22607:  diffs.txt added by jwe (1KiB - text/plain)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by dbateman (Updated the item)
  • -unavailable- added by bpabbott (Posted a comment)
  • -unavailable- added by bpabbott
  • -unavailable- added by jwe
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by dasergatskov (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 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 06 Feb 2011 02:24:03 PM UTCbpabbottAttached File-=>Added demo_legend_18.pdf, #22609
    Sat 05 Feb 2011 03:47:41 PM UTCdbatemanStatusIn Progress=>Fixed
      Assigned toNone=>dbateman
      Open/ClosedOpen=>Closed
    Fri 04 Feb 2011 11:09:41 PM UTCdbatemanDependencies-=>Depends on bugs #32022
    Fri 04 Feb 2011 10:58:07 PM UTCdbatemanAttached File-=>Added patch.legend, #22608
    Fri 04 Feb 2011 08:44:18 PM UTCjweAttached File-=>Added diffs.txt, #22607
    Fri 04 Feb 2011 12:34:53 AM UTCbpabbottCarbon-Copy-=>Added -unavailable-
    Thu 03 Feb 2011 10:52:52 PM UTCjweAssigned tojwe=>None
      Carbon-Copy-=>Added bpabbott
    Thu 03 Feb 2011 09:47:22 PM UTCjweStatusNone=>In Progress
      Assigned toNone=>jwe

    Back to the top


    Powered by Savane 3.1-cleanup1