[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with legend
From: |
Ben Abbott |
Subject: |
Re: help with legend |
Date: |
Sun, 15 Jan 2012 20:10:03 -0500 |
On Jan 15, 2012, at 2:35 PM, Ben Abbott wrote:
> On Jan 15, 2012, at 12:48 PM, Valmor de Almeida wrote:
>
>> Hello,
>>
>> I am trying to customize legends on a plotyy axes/lines but I am not
>> able to. Here are the commands:
>>
>> [ax, h1, h2] = plotyy(x1,y1, x2,y2, @plot, @plot);
>>
>> legend(h1,y1Label,"location",'south',"fontname",'Helvetica');
>>
>> legend(h2,y2Label,"location",'northeast',"fontname",'Helvetica');
>>
>> Only the first legend shows up and the font is Courier which I am unable
>> to change. Also the text in the legend precedes the key which I would
>> like to invert using 'right' but it does not work either.
>>
>> I am using octave-3.4.0. Would anyone have an example?
>>
>> Thanks,
>>
>> --
>> Valmor
>>
>> PS: In the above command I also tried legend(ax(1),...) and it does not
>> make a difference.
>
> Octave tries to duplicate Matlab's implementation of plotyy and legend.
>
> x1 = 0:5:10;
> x2 = 0:10;
> y1 = rand (size (x1));
> y2 = rand (size (x2));
> [ax, h1, h2] = plotyy (x1, y1, x2, y2, @plot, @plot);
> y1Label = "y1";
> y2Label = "y2";
>
> The command below should produce the desired legend (please check, the
> implementation may have changed since 3.4.0).
>
> legend ([h1, h2], {y1Label, y2Label}, "location", "south")
>
> The commands below should also work, but currently reverse the legend entries.
>
> legend ({y1Label, y2Label}, "location", "south")
>
> legend (y1Label, y2Label, "location", "south");
>
> I've entered a bug report in the tracker.
>
> https://savannah.gnu.org/bugs/?35314
>
> Regarding "Fontsize", the legend function doesn't accept property
> names/values as input.
>
> To change the fontname, the legend command returns the handle to the legend.
> You can change its fontname property directly.
>
> h = legend ([h1, h2], {y1Label, y2Label}, "location", "south")
> set (h, "fontname",'Helvetica")
>
> Ben
I've attached a changeset to the bug-tracker that fixes the legend command so
that all three versions below work the same.
legend ([h1, h2], {y1Label, y2Label}, "location", "south")
legend ({y1Label, y2Label}, "location", "south")
legend (y1Label, y2Label, "location", "south");
The tracker link is below.
https://savannah.gnu.org/bugs/index.php?35314
Ben
- help with legend, Valmor de Almeida, 2012/01/15
- Re: help with legend, Ben Abbott, 2012/01/15
- Re: help with legend,
Ben Abbott <=
- Re: help with legend, Valmor de Almeida, 2012/01/15
- Re: help with legend, Ben Abbott, 2012/01/16
- Re: help with legend, Valmor de Almeida, 2012/01/17
- Re: help with legend, Ben Abbott, 2012/01/17
- Re: help with legend, Valmor de Almeida, 2012/01/17
- Re: help with legend, Ben Abbott, 2012/01/17
- Re: help with legend, Valmor de Almeida, 2012/01/18
- Re: help with legend, Ben Abbott, 2012/01/18