pbaspect() and legend

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

pbaspect() and legend

José Luis García Pallero
Hello:

I need to use the pbaspect() function in order to customize a figure
aspect ratio. All works perfect except the legend, which is not
maintained inside the plot box after the pbaspect() call. But in
Matlab the legend is affected by the function. Is it a bug in the
Octave pbaspect()?

I'm using this script:

plot(rand(3));
legend('First','Second','Third');
pbaspect([2 1 1]);
print('check_pbaspect.png','-dpng');

--
*****************************************
José Luis García Pallero
[hidden email]
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************

Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

Rik-4
On 01/28/2020 09:00 AM, [hidden email] wrote:
Subject:
pbaspect() and legend
From:
José Luis García Pallero [hidden email]
Date:
01/28/2020 08:12 AM
To:
Octave Maintainers [hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0
Message-ID:
[hidden email]
Content-Type:
text/plain; charset="UTF-8"
Message:
4

Hello:

I need to use the pbaspect() function in order to customize a figure
aspect ratio. All works perfect except the legend, which is not
maintained inside the plot box after the pbaspect() call. But in
Matlab the legend is affected by the function. Is it a bug in the
Octave pbaspect()?

I'm using this script:

plot(rand(3));
legend('First','Second','Third');
pbaspect([2 1 1]);
print('check_pbaspect.png','-dpng');
I can reproduce this.  Can you file a bug report?

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

José Luis García Pallero


El mar., 28 ene. 2020 a las 18:13, Rik (<[hidden email]>) escribió:
On 01/28/2020 09:00 AM, [hidden email] wrote:
Subject:
pbaspect() and legend
From:
José Luis García Pallero [hidden email]
Date:
01/28/2020 08:12 AM
To:
Octave Maintainers [hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0
Message-ID:
[hidden email]
Content-Type:
text/plain; charset="UTF-8"
Message:
4

Hello:

I need to use the pbaspect() function in order to customize a figure
aspect ratio. All works perfect except the legend, which is not
maintained inside the plot box after the pbaspect() call. But in
Matlab the legend is affected by the function. Is it a bug in the
Octave pbaspect()?

I'm using this script:

plot(rand(3));
legend('First','Second','Third');
pbaspect([2 1 1]);
print('check_pbaspect.png','-dpng');
I can reproduce this.  Can you file a bug report?

Done
 

--Rik



--
*****************************************
José Luis García Pallero
[hidden email]
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

nrjank
In reply to this post by José Luis García Pallero
On Tue, Jan 28, 2020 at 11:13 AM José Luis García Pallero
<[hidden email]> wrote:

>
> Hello:
>
> I need to use the pbaspect() function in order to customize a figure
> aspect ratio. All works perfect except the legend, which is not
> maintained inside the plot box after the pbaspect() call. But in
> Matlab the legend is affected by the function. Is it a bug in the
> Octave pbaspect()?
>
> I'm using this script:
>
> plot(rand(3));
> legend('First','Second','Third');
> pbaspect([2 1 1]);
>

I can confirm this behavior appears to be a noncompatibility bug in
Octave.  Testing in Octave and Matlab 2019a, I get the two attached
different figures (appears the same both on screen and in the
generated png)

check_pbaspect_octave5.1.0.png (62K) Download Attachment
check_pbaspect_matlab2019a.png (27K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

nrjank
On Tue, Jan 28, 2020 at 12:55 PM Nicholas Jankowski <[hidden email]> wrote:

>
> On Tue, Jan 28, 2020 at 11:13 AM José Luis García Pallero
> <[hidden email]> wrote:
> >
> > Hello:
> >
> > I need to use the pbaspect() function in order to customize a figure
> > aspect ratio. All works perfect except the legend, which is not
> > maintained inside the plot box after the pbaspect() call. But in
> > Matlab the legend is affected by the function. Is it a bug in the
> > Octave pbaspect()?
> >
> > I'm using this script:
> >
> > plot(rand(3));
> > legend('First','Second','Third');
> > pbaspect([2 1 1]);
> >
>
>
> I can confirm this behavior appears to be a noncompatibility bug in
> Octave.  Testing in Octave and Matlab 2019a, I get the two attached
> different figures (appears the same both on screen and in the
> generated png)

playing with this a bit further, I notice that it makes no difference
if I switch the order of the legend and pbaspect calls. Also in matlab
the legend appears to stay pinned to the plot (say, if I resize the
figure window, legend stays in the upper right of the plot), whereas
in octave the legend seems to want to stay pinned to the window, and
will move in or out of the plot pane as necessary to maintain window
position.

Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

nrjank
I see you just created a bug report here:
https://savannah.gnu.org/bugs/?57685

I'll append those images and info.

Reply | Threaded
Open this post in threaded view
|

Re: pbaspect() and legend

Rik-4
In reply to this post by José Luis García Pallero
On 01/28/2020 09:55 AM, [hidden email] wrote:
Subject:
Re: pbaspect() and legend
From:
José Luis García Pallero [hidden email]
Date:
01/28/2020 09:26 AM
To:
Rik [hidden email]
CC:
Octave Maintainers [hidden email]
List-Post:
[hidden email]
Precedence:
list
MIME-Version:
1.0
References:
[hidden email] <MTAwMDAwNy5ub21hZA.1580231620@quikprotect>
In-Reply-To:
<MTAwMDAwNy5ub21hZA.1580231620@quikprotect>
Message-ID:
[hidden email]
Content-Type:
multipart/alternative; boundary="000000000000bfd687059d36894d"
Message:
2



El mar., 28 ene. 2020 a las 18:13, Rik (<[hidden email]>) escribió:
On 01/28/2020 09:00 AM, [hidden email] wrote:
Subject:
pbaspect() and legend
From:
José Luis García Pallero [hidden email]
Date:
01/28/2020 08:12 AM
To:
Octave Maintainers [hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0
Message-ID:
[hidden email]
Content-Type:
text/plain; charset="UTF-8"
Message:
4

Hello:

I need to use the pbaspect() function in order to customize a figure
aspect ratio. All works perfect except the legend, which is not
maintained inside the plot box after the pbaspect() call. But in
Matlab the legend is affected by the function. Is it a bug in the
Octave pbaspect()?

I'm using this script:

plot(rand(3));
legend('First','Second','Third');
pbaspect([2 1 1]);
print('check_pbaspect.png','-dpng');
I can reproduce this.  Can you file a bug report?

Done

Not ideal, but in the meantime you can work around this by manually changing the position of the legend object.

hl = legend ();  # get handle to legend object
pos = get (hl, "position");
... modify pos variable ...
set (hl, "position", pos)

This should work if you absolutely need to produce a figure for publication immediately.

--Rik