|
From: | David Bateman |
Subject: | Re: [changeset] - improve clf() compatibility |
Date: | Wed, 22 Oct 2008 15:53:38 +0100 |
User-agent: | Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
John W. Eaton wrote:
Ok, this one is subtle.. The problem is that the callback function that is associated with the plotyy axes is not removed by the newplot call in quiver3 -> __quiver__ -> plot3. Therefore, as one of the axes of the plotyy object remains and the other is destroyed, the update_position callback in plotyy.m tries to update a non existent axis with the change of view.I still see some strange behavior. * Try demo plotyy demo quiver3 Both of these demos seem to work OK if run separately in fresh Octave sessions, but plotyy seems to be leaving some state that causes quiver3 to fail with octave:2> demo quiver3 quiver3 example 1:[x,y]=meshgrid (-1:0.1:1); z=sin(2*pi*sqrt(x.^2+y.^2)); theta=2*pi*sqrt(x.^2+y.^2)+pi/2;quiver3(x,y,z,sin(theta),cos(theta),ones(size(z)));hold on; mesh(x,y,z); hold off;quiver3 example 1: failedget: invalid handle (= -1.22961)Press <enter> to continue: quiver3 example 2:[x, y, z] = peaks (25); surf (x, y, z); hold on; [u, v, w] = surfnorm (x, y, z / 10); h = quiver3 (x, y, z, u, v, w); set (h, "maxheadsize", 0.33); quiver3 example 2: failed get: invalid handle (= -1.22961)error: get: invalid handle (= -14.6238) error: called from: error: /home/jwe/src/octave/scripts/plot/__go_draw_axes__.m at line 60, column 9 error: /home/jwe/src/octave/scripts/plot/__go_draw_figure__.m at line 58, column 8 error: /home/jwe/src/octave/scripts/plot/gnuplot_drawnow.m at line 66, column 5
There are two solutions to this1) The simple and wrong solution is to just test if the axis to update in the plotyy callback still exists before trying to update it. A patch as simple as
diff --git a/scripts/plot/plotyy.m b/scripts/plot/plotyy.m --- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -203,7 +203,7 @@ persistent recursion = false; ## Don't allow recursion - if (! recursion) + if (! recursion && ishandle (ax2) && strcmp (get (ax2, "type"), "axes")) unwind_protect recursion = true; position = get (h, "position");will do that and will prevent the error. However, the callback is continually called while the axis exists..
2) The correct solution is to have a means of removing callback functions in the deletefcn of plotyy. So we need a dellistener function that corresponds to the existing addlistener function.. I'm working on a patch along these lines.
D. -- David Bateman address@hiddenMotorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob) 91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax) The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary
[Prev in Thread] | Current Thread | [Next in Thread] |