Sun 06 Feb 2011 07:48:01 PM UTC, comment #14:
I'll file a new bug report.
|
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!
|
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?
|
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.
|
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)
|
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.
|
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
|
Sat 05 Feb 2011 03:47:41 PM UTC, comment #7:
Ok closed
D.
|
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?
|
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)
|
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)
|
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.
|
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.
|
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.
|
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"...
|