Re: Octave specific legend calling forms

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Octave specific legend calling forms

Rik-4
On 10/10/2019 09:00 AM, [hidden email] wrote:
Subject:
Re: Octave specific legend call forms
From:
Pantxo Diribarne [hidden email]
Date:
10/10/2019 07:32 AM
To:
Ben Abbott [hidden email]
CC:
Octave Maintainers [hidden email]
List-Post:
[hidden email]
Precedence:
list
MIME-Version:
1.0
References:
[hidden email] [hidden email]
In-Reply-To:
[hidden email]
Message-ID:
[hidden email]
Content-Type:
multipart/alternative; boundary="000000000000a3a90605948f4540"
Message:
4



Le jeu. 10 oct. 2019 à 16:26, Ben Abbott <[hidden email]> a écrit :


> On Oct 10, 2019, at 15:21, Pantxo Diribarne <[hidden email]> wrote:
>
> 
> Hello,
>
> I am currently trying to rewrite the legend function and would like your opinion on an Octave specific way of manipulating legend objects. In demos we often use the following construct:
>
> plot (1:10);
> h = legend ("Hello");
> legend (h, "fontsize", 20);
>
> The last line is strange. We use "legend" to do what "set" should be doing. AFAICS this construct is not documented (only axes handles are documented to be possible as first argument). IMHO it doesn't feel natural to replace "set" by "legend" and doesn't bring any simplification so I'd like to remove this Octave specific call form.
>
> Any opinion?
>
> Pantxo 

 Matlab behaves that way.?

Ben

No, Matlab (2019b, tested online) forbids legend objects as first argument.


Did Matlab used to support this syntax?  If so, we would want Octave to stay backward-compatible for a while so that everyone's scripts from 5 years ago are still operative.

Overall, though, I agree that once you have a legend object in a handle it makes sense to act on the handle rather than re-invoking legend.

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Octave specific legend calling forms

Colin Macdonald-2
On 2019-10-10 9:48 a.m., Rik wrote:
>> No, Matlab (2019b, tested online) forbids legend objects as first
>> argument.
>>
>
> Did Matlab used to support this syntax?  If so, we would want Octave to
> stay backward-compatible for a while so that everyone's scripts from 5
> years ago are still operative.

On 2014a it seems to just make a legend with the text "fontsize",
subsequent calls are an error.


Reply | Threaded
Open this post in threaded view
|

Re: Octave specific legend calling forms

mmuetzel
In reply to this post by Rik-4
Am 10. Oktober 2019 um 18:48 Uhr schrieb "Rik":

On 10/10/2019 09:00 AM, [hidden email][mailto:[hidden email]] wrote:

Subject:Re: Octave specific legend call forms

From:Pantxo Diribarne <[hidden email]>[mailto:[hidden email]]

Date:10/10/2019 07:32 AM

To:Ben Abbott <[hidden email]>[mailto:[hidden email]]

CC:Octave Maintainers <[hidden email]>[mailto:[hidden email]]

List-Post:<mailto:[hidden email]>[mailto:[hidden email]]

Precedence:list

MIME-Version:1.0

References:<CAFM7nBWRV2k9oMW4MiwTXz3gFf_py14uJGSG7CdZ=n0YQ5=+[hidden email]>[mailto:CAFM7nBWRV2k9oMW4MiwTXz3gFf_py14uJGSG7CdZ=n0YQ5=+[hidden email]] <[hidden email]>[mailto:[hidden email]]

In-Reply-To:<[hidden email]>[mailto:[hidden email]]

Message-ID:<CAFM7nBVeM3ALwwN9a9BiGn+ETYuZ53eY=[hidden email]>[mailto:CAFM7nBVeM3ALwwN9a9BiGn+ETYuZ53eY=[hidden email]]

Content-Type:multipart/alternative; boundary="000000000000a3a90605948f4540"

Message:4  

  

Le jeu. 10 oct. 2019 à 16:26, Ben Abbott <[hidden email][mailto:[hidden email]]> a écrit :

> On Oct 10, 2019, at 15:21, Pantxo Diribarne <[hidden email][mailto:[hidden email]]> wrote:
>
> 
> Hello,
>
> I am currently trying to rewrite the legend function and would like your opinion on an Octave specific way of manipulating legend objects. In demos we often use the following construct:
>
> plot (1:10);
> h = legend ("Hello");
> legend (h, "fontsize", 20);
>
> The last line is strange. We use "legend" to do what "set" should be doing. AFAICS this construct is not documented (only axes handles are documented to be possible as first argument). IMHO it doesn't feel natural to replace "set" by "legend" and doesn't bring any simplification so I'd like to remove this Octave specific call form.
>
> Any opinion?
>
> Pantxo 

 Matlab behaves that way.?

Ben
 
No, Matlab (2019b, tested online) forbids legend objects as first argument.
 
Did Matlab used to support this syntax?  If so, we would want Octave to stay backward-compatible for a while so that everyone's scripts from 5 years ago are still operative.

Overall, though, I agree that once you have a legend object in a handle it makes sense to act on the handle rather than re-invoking legend.

--Rik


I tried with Matlab R2012a and it doesn't work as one might expect. The label in the legend changes to "fontsize".
If that syntax ever worked like this in Matlab, it seems to be long time gone.

Markus