plotyy force dataaspectratio

View: New views
5 Messages — Rating Filter:   Alert me  

plotyy force dataaspectratio

by Christoph Ellenberger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I am using the regular mingw snapshots for windows. Some of my scripts got broken when I updated from 3.2.0 to 3.2.2/3. It is about using two axis plots with plotyy. The problem is that after I change axis properties the plot of the second axis gets way too small (see fig). I traced it down to the update_position function in plotyy where the dataaspectratio property from the first axis is forced onto the second axis which does not make sense. Now I don't know what the intended behaviour of this function would have been or if the function is called somewhere with the wrong axes handles but as far as I understand it, it should be reverted to the 3.2.0 version as it only updates the positioning, which in my opinion does not change the aspectratio...

3.2.2/3
function update_position (h, d, ax2)
  persistent recursion = false;

  ## Don't allow recursion
  if (! recursion)
    unwind_protect
      recursion = true;
      position = get (h, "position");
      view = get (h, "view");
      dataaspectratio = get (h, "dataaspectratio");
      oldposition = get (ax2, "position");
      oldview = get (ax2, "view");
      olddataaspectratio = get (ax2, "dataaspectratio");
      if (! (isequal (position, oldposition)
             && isequal (view, oldview)
             && isequal (dataaspectratio, olddataaspectratio)))
        set (ax2, "position", position,
                  "view", view,
                  "dataaspectratio", dataaspectratio);
      endif
    unwind_protect_cleanup
      recursion = false;
    end_unwind_protect
  endif  
endfunction

3.2.0 and my suggestion
function update_position (h, d, ax2)
  persistent recursion = false;

  ## Don't allow recursion
  if (! recursion)
    unwind_protect
      recursion = true;
      position = get (h, "position");
      view = get (h, "view");
      oldposition = get (ax2, "position");
      oldview = get (ax2, "view");
      if (! (isequal (position, oldposition) && isequal (view, oldview)))
        set (ax2, "position", position, "view", view);
      endif
    unwind_protect_cleanup
      recursion = false;
    end_unwind_protect
  endif  
endfunction


thanks in advance
christoph
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

plotyy.jpg (38K) Download Attachment

Re: plotyy force dataaspectratio

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 9, 2009, at 6:17 AM, Christoph Ellenberger wrote:

> Hi,
> I am using the regular mingw snapshots for windows. Some of my  
> scripts got broken when I updated from 3.2.0 to 3.2.2/3. It is about  
> using two axis plots with plotyy. The problem is that after I change  
> axis properties the plot of the second axis gets way too small (see  
> fig). I traced it down to the update_position function in plotyy  
> where the dataaspectratio property from the first axis is forced  
> onto the second axis which does not make sense. Now I don't know  
> what the intended behaviour of this function would have been or if  
> the function is called somewhere with the wrong axes handles but as  
> far as I understand it, it should be reverted to the 3.2.0 version  
> as it only updates the positioning, which in my opinion does not  
> change the aspectratio...
>
> 3.2.2/3
> function update_position (h, d, ax2)
>  persistent recursion = false;
>
>  ## Don't allow recursion
>  if (! recursion)
>    unwind_protect
>      recursion = true;
>      position = get (h, "position");
>      view = get (h, "view");
>      dataaspectratio = get (h, "dataaspectratio");
>      oldposition = get (ax2, "position");
>      oldview = get (ax2, "view");
>      olddataaspectratio = get (ax2, "dataaspectratio");
>      if (! (isequal (position, oldposition)
>             && isequal (view, oldview)
>             && isequal (dataaspectratio, olddataaspectratio)))
> set (ax2, "position", position,
>                  "view", view,
>  "dataaspectratio", dataaspectratio);
>      endif
>    unwind_protect_cleanup
>      recursion = false;
>    end_unwind_protect
>  endif
> endfunction
>
> 3.2.0 and my suggestion
> function update_position (h, d, ax2)
>  persistent recursion = false;
>
>  ## Don't allow recursion
>  if (! recursion)
>    unwind_protect
>      recursion = true;
>      position = get (h, "position");
>      view = get (h, "view");
>      oldposition = get (ax2, "position");
>      oldview = get (ax2, "view");
>      if (! (isequal (position, oldposition) && isequal (view,  
> oldview)))
> set (ax2, "position", position, "view", view);
>      endif
>    unwind_protect_cleanup
>      recursion = false;
>    end_unwind_protect
>  endif
> endfunction
>
> thanks in advance
> christoph

Please verify that your proposed change works for the demos. You can  
do that by starting Octave and typing ...

        demo plotyy

Also, it would be useful to add a new demo for your case. Can you give  
us a simple example where 3.2.3 produces the wrong result?

Ben

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: plotyy force dataaspectratio

by Christoph Ellenberger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tested the demos and they still work, though as I said the error might be at a different spot. Because the problem occurs when calling the axis command on the second axis itself (using the first works well), so it might be that the axis command is calling update_position with a wrong handle set, but I haven't actually found from where this function is called. I only saw that it is copying the dataaspectratio from axis1 to axis2 as it is called with h=handle axis1 and ax2=handle axis2

So here is my "simple example":

x=1:8;
y=7000:20:7140;
y2=repmat(2,1,8);
ax=plotyy(x,y,x,y2);
lim=axis;
lim(1:4)=[3 5 1 5];
axis(lim);

My suggestion is just a workaround for the function as it is called right now, but wouldn't fix it if the idea of the reposition is to compare it with older axis properties, but to my idea of it it is not intended to copy the dataaspectratio if just the position of an axis is changed.

kind regards
christoph

-------- Original-Nachricht --------
> Datum: Mon, 09 Nov 2009 07:46:21 -0500
> Von: Ben Abbott <bpabbott@...>
> An: Christoph Ellenberger <C.Ellenberger@...>
> CC: bug-octave@...
> Betreff: Re: plotyy force dataaspectratio

>
> On Nov 9, 2009, at 6:17 AM, Christoph Ellenberger wrote:
>
> > Hi,
> > I am using the regular mingw snapshots for windows. Some of my  
> > scripts got broken when I updated from 3.2.0 to 3.2.2/3. It is about  
> > using two axis plots with plotyy. The problem is that after I change  
> > axis properties the plot of the second axis gets way too small (see  
> > fig). I traced it down to the update_position function in plotyy  
> > where the dataaspectratio property from the first axis is forced  
> > onto the second axis which does not make sense. Now I don't know  
> > what the intended behaviour of this function would have been or if  
> > the function is called somewhere with the wrong axes handles but as  
> > far as I understand it, it should be reverted to the 3.2.0 version  
> > as it only updates the positioning, which in my opinion does not  
> > change the aspectratio...
> >
> > 3.2.2/3
> > function update_position (h, d, ax2)
> >  persistent recursion = false;
> >
> >  ## Don't allow recursion
> >  if (! recursion)
> >    unwind_protect
> >      recursion = true;
> >      position = get (h, "position");
> >      view = get (h, "view");
> >      dataaspectratio = get (h, "dataaspectratio");
> >      oldposition = get (ax2, "position");
> >      oldview = get (ax2, "view");
> >      olddataaspectratio = get (ax2, "dataaspectratio");
> >      if (! (isequal (position, oldposition)
> >             && isequal (view, oldview)
> >             && isequal (dataaspectratio, olddataaspectratio)))
> > set (ax2, "position", position,
> >                  "view", view,
> >  "dataaspectratio", dataaspectratio);
> >      endif
> >    unwind_protect_cleanup
> >      recursion = false;
> >    end_unwind_protect
> >  endif
> > endfunction
> >
> > 3.2.0 and my suggestion
> > function update_position (h, d, ax2)
> >  persistent recursion = false;
> >
> >  ## Don't allow recursion
> >  if (! recursion)
> >    unwind_protect
> >      recursion = true;
> >      position = get (h, "position");
> >      view = get (h, "view");
> >      oldposition = get (ax2, "position");
> >      oldview = get (ax2, "view");
> >      if (! (isequal (position, oldposition) && isequal (view,  
> > oldview)))
> > set (ax2, "position", position, "view", view);
> >      endif
> >    unwind_protect_cleanup
> >      recursion = false;
> >    end_unwind_protect
> >  endif
> > endfunction
> >
> > thanks in advance
> > christoph
>
> Please verify that your proposed change works for the demos. You can  
> do that by starting Octave and typing ...
>
> demo plotyy
>
> Also, it would be useful to add a new demo for your case. Can you give  
> us a simple example where 3.2.3 produces the wrong result?
>
> Ben
>
> _______________________________________________
> Bug-octave mailing list
> Bug-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

--
 

GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: plotyy force dataaspectratio

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday, November 09, 2009, at 09:09AM, "Christoph Ellenberger" <C.Ellenberger@...> wrote:

>
>-------- Original-Nachricht --------
>> Datum: Mon, 09 Nov 2009 07:46:21 -0500
>> Von: Ben Abbott <bpabbott@...>
>> An: Christoph Ellenberger <C.Ellenberger@...>
>> CC: bug-octave@...
>> Betreff: Re: plotyy force dataaspectratio
>
>>
>> On Nov 9, 2009, at 6:17 AM, Christoph Ellenberger wrote:
>>
>> > Hi,
>> > I am using the regular mingw snapshots for windows. Some of my  
>> > scripts got broken when I updated from 3.2.0 to 3.2.2/3. It is about  
>> > using two axis plots with plotyy. The problem is that after I change  
>> > axis properties the plot of the second axis gets way too small (see  
>> > fig). I traced it down to the update_position function in plotyy  
>> > where the dataaspectratio property from the first axis is forced  
>> > onto the second axis which does not make sense. Now I don't know  
>> > what the intended behaviour of this function would have been or if  
>> > the function is called somewhere with the wrong axes handles but as  
>> > far as I understand it, it should be reverted to the 3.2.0 version  
>> > as it only updates the positioning, which in my opinion does not  
>> > change the aspectratio...
>> >
>> > 3.2.2/3
>> > function update_position (h, d, ax2)
>> >  persistent recursion = false;
>> >
>> >  ## Don't allow recursion
>> >  if (! recursion)
>> >    unwind_protect
>> >      recursion = true;
>> >      position = get (h, "position");
>> >      view = get (h, "view");
>> >      dataaspectratio = get (h, "dataaspectratio");
>> >      oldposition = get (ax2, "position");
>> >      oldview = get (ax2, "view");
>> >      olddataaspectratio = get (ax2, "dataaspectratio");
>> >      if (! (isequal (position, oldposition)
>> >             && isequal (view, oldview)
>> >             && isequal (dataaspectratio, olddataaspectratio)))
>> > set (ax2, "position", position,
>> >                  "view", view,
>> >  "dataaspectratio", dataaspectratio);
>> >      endif
>> >    unwind_protect_cleanup
>> >      recursion = false;
>> >    end_unwind_protect
>> >  endif
>> > endfunction
>> >
>> > 3.2.0 and my suggestion
>> > function update_position (h, d, ax2)
>> >  persistent recursion = false;
>> >
>> >  ## Don't allow recursion
>> >  if (! recursion)
>> >    unwind_protect
>> >      recursion = true;
>> >      position = get (h, "position");
>> >      view = get (h, "view");
>> >      oldposition = get (ax2, "position");
>> >      oldview = get (ax2, "view");
>> >      if (! (isequal (position, oldposition) && isequal (view,  
>> > oldview)))
>> > set (ax2, "position", position, "view", view);
>> >      endif
>> >    unwind_protect_cleanup
>> >      recursion = false;
>> >    end_unwind_protect
>> >  endif
>> > endfunction
>> >
>> > thanks in advance
>> > christoph
>>
>> Please verify that your proposed change works for the demos. You can  
>> do that by starting Octave and typing ...
>>
>> demo plotyy
>>
>> Also, it would be useful to add a new demo for your case. Can you give  
>> us a simple example where 3.2.3 produces the wrong result?
>>
>> Ben
>>
>
>I tested the demos and they still work, though as I said the error might be at a different spot. Because the problem occurs when calling the axis command on the second axis itself (using the first works well), so it might be that the axis command is calling update_position with a wrong handle set, but I haven't actually found from where this function is called. I only saw that it is copying the dataaspectratio from axis1 to axis2 as it is called with h=handle axis1 and ax2=handle axis2
>
>So here is my "simple example":
>
>x=1:8;
>y=7000:20:7140;
>y2=repmat(2,1,8);
>ax=plotyy(x,y,x,y2);
>lim=axis;
>lim(1:4)=[3 5 1 5];
>axis(lim);
>
>My suggestion is just a workaround for the function as it is called right now, but wouldn't fix it if the idea of the reposition is to compare it with older axis properties, but to my idea of it it is not intended to copy the dataaspectratio if just the position of an axis is changed.
>
>kind regards
>christoph

I tried your example with current version for 3.2.x. The result looks correct to me. Meaning it is consistent with what Matlab produces.

The current version for 3.2.x can be found at the like below.

    http://hg.tw-math.de/release-3-2-x/file/fee95bb4ee94/scripts/plot/plotyy.m

Ben




Ben

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: plotyy force dataaspectratio

by bung :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I get the same result as the original poster, and definetly not an acceptable result using the 3.2.3 plotyy.m linked, I even checked with a deff with my installed version.

The plot looks fine until you set limits on an axis. I have even managed to get the y-axis to shrink trying some things.

Again I only see problems when I do something like
set(ax(1),'ylim',[0,100]), see attached picture


Ben Abbott wrote:
On Monday, November 09, 2009, at 09:09AM, "Christoph Ellenberger" <C.Ellenberger@gmx.net> wrote:
>
>-------- Original-Nachricht --------
>> Datum: Mon, 09 Nov 2009 07:46:21 -0500
>> Von: Ben Abbott <bpabbott@mac.com>
>> An: Christoph Ellenberger <C.Ellenberger@gmx.net>
>> CC: bug-octave@octave.org
>> Betreff: Re: plotyy force dataaspectratio
>
>>
>> On Nov 9, 2009, at 6:17 AM, Christoph Ellenberger wrote:
>>
>> > Hi,
>> > I am using the regular mingw snapshots for windows. Some of my  
>> > scripts got broken when I updated from 3.2.0 to 3.2.2/3. It is about  
>> > using two axis plots with plotyy. The problem is that after I change  
>> > axis properties the plot of the second axis gets way too small (see  
>> > fig). I traced it down to the update_position function in plotyy  
>> > where the dataaspectratio property from the first axis is forced  
>> > onto the second axis which does not make sense. Now I don't know  
>> > what the intended behaviour of this function would have been or if  
>> > the function is called somewhere with the wrong axes handles but as  
>> > far as I understand it, it should be reverted to the 3.2.0 version  
>> > as it only updates the positioning, which in my opinion does not  
>> > change the aspectratio...
>> >
>> > 3.2.2/3
>> > function update_position (h, d, ax2)
>> >  persistent recursion = false;
>> >
>> >  ## Don't allow recursion
>> >  if (! recursion)
>> >    unwind_protect
>> >      recursion = true;
>> >      position = get (h, "position");
>> >      view = get (h, "view");
>> >      dataaspectratio = get (h, "dataaspectratio");
>> >      oldposition = get (ax2, "position");
>> >      oldview = get (ax2, "view");
>> >      olddataaspectratio = get (ax2, "dataaspectratio");
>> >      if (! (isequal (position, oldposition)
>> >             && isequal (view, oldview)
>> >             && isequal (dataaspectratio, olddataaspectratio)))
>> > set (ax2, "position", position,
>> >                  "view", view,
>> >  "dataaspectratio", dataaspectratio);
>> >      endif
>> >    unwind_protect_cleanup
>> >      recursion = false;
>> >    end_unwind_protect
>> >  endif
>> > endfunction
>> >
>> > 3.2.0 and my suggestion
>> > function update_position (h, d, ax2)
>> >  persistent recursion = false;
>> >
>> >  ## Don't allow recursion
>> >  if (! recursion)
>> >    unwind_protect
>> >      recursion = true;
>> >      position = get (h, "position");
>> >      view = get (h, "view");
>> >      oldposition = get (ax2, "position");
>> >      oldview = get (ax2, "view");
>> >      if (! (isequal (position, oldposition) && isequal (view,  
>> > oldview)))
>> > set (ax2, "position", position, "view", view);
>> >      endif
>> >    unwind_protect_cleanup
>> >      recursion = false;
>> >    end_unwind_protect
>> >  endif
>> > endfunction
>> >
>> > thanks in advance
>> > christoph
>>
>> Please verify that your proposed change works for the demos. You can  
>> do that by starting Octave and typing ...
>>
>> demo plotyy
>>
>> Also, it would be useful to add a new demo for your case. Can you give  
>> us a simple example where 3.2.3 produces the wrong result?
>>
>> Ben
>>
>
>I tested the demos and they still work, though as I said the error might be at a different spot. Because the problem occurs when calling the axis command on the second axis itself (using the first works well), so it might be that the axis command is calling update_position with a wrong handle set, but I haven't actually found from where this function is called. I only saw that it is copying the dataaspectratio from axis1 to axis2 as it is called with h=handle axis1 and ax2=handle axis2
>
>So here is my "simple example":
>
>x=1:8;
>y=7000:20:7140;
>y2=repmat(2,1,8);
>ax=plotyy(x,y,x,y2);
>lim=axis;
>lim(1:4)=[3 5 1 5];
>axis(lim);
>
>My suggestion is just a workaround for the function as it is called right now, but wouldn't fix it if the idea of the reposition is to compare it with older axis properties, but to my idea of it it is not intended to copy the dataaspectratio if just the position of an axis is changed.
>
>kind regards
>christoph

I tried your example with current version for 3.2.x. The result looks correct to me. Meaning it is consistent with what Matlab produces.

The current version for 3.2.x can be found at the like below.

    http://hg.tw-math.de/release-3-2-x/file/fee95bb4ee94/scripts/plot/plotyy.m

Ben




Ben

_______________________________________________
Bug-octave mailing list
Bug-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave