Legend labels order

John W. Eaton jwe at octave.org
Thu Jul 23 09:27:14 CDT 2009


On 22-Jul-2009, Marco Caliari wrote:

| I discovered the following problem in 3.2.x. When you have two plots but 
| only one legend label, such as in
| 
| x=linspace(0,10);,plot(x,x,x,x.^2),legend('linear')
| 
| the label is attached to the second plot. Similar behavior in the case
| 
| x=linspace(0,10);,plot(x,x,x,x.^2,x,x.^3),legend('linear','quadratic')
| 
| or
| 
| x=linspace(0,10);,plot(x,x),hold on,plot(x,x.^2,'g'),legend('linear')
| 
| I'm able to fix this problem if I substitute
| 
| set (kids(k), "keylabel", arg);
| 
| with
| 
| set (kids(nkids-nargs+k), "keylabel", arg);
| 
| in legend.m (two occourences). But, since there is a similar code some 
| rows above regarding hggroup (and I don't know what a hggroup is), I 
| cannot submit a complete patch. I hope somebody else can fix it.

The hggroup object is used for things like stem plots.

I checked in the following change

  http://hg.savannah.gnu.org/hgweb/octave/rev/350148cc0774

It seems to work corrctly for me.

Could you please try it with 3.2.x and let us know if you see
problems?  If it works, then I suppose it would be OK to include with
a future 3.2.x release.

jwe


More information about the Bug-octave mailing list