On 5/19/08, John Hunter <[EMAIL PROTECTED]> wrote: > On Mon, May 19, 2008 at 2:36 AM, G Jones <[EMAIL PROTECTED]> wrote: > > Hello, > > I am experiencing a bug when trying to blit a canvas that contains two > > axes, one with a line plot and the other with an imshow plot. The > > attached example, QtBlitBugDemo.py demonstrates the problem. As is, on > > my machine, the > > imshow plot updates correctly, but the line plot acts like the > > background is not being restored correctly, the lines keep piling up > > on top of each other, even though I am explicitly restoring a clean > > background before drawing the artist. If I simply comment out the > > line: > > self.specPlotB.draw_artist(self.specArtistB) > > which draws the imshow artist, the line plot behaves correctly. > > I haven't been able to figure out what is causing this behavior. > > I am using r5186 from the SVN. The output from running with debug mode > > on is below. > > > I don't have qt installed so I can't test this here, but poking > through the code one thing looks badly wrong (though it may be > unrelated to your problem) > > if self.autoSpec: > self.specPlotT.relim() > self.specPlotT.autoscale_view(scalex = False, scaley = True) > > you cannot change the viewlim when updating your animated artists (nor > should you change the grid). The idea is > > > > - draw (everything but animated by default) > > > -- copy the background > > start animation loop: > > * restore background > > * update *only* your animated artists and change nothing else > about the figure (viewlim, grid, labels, etc) > > * draw your animated artists > > * blit > > If you need to change anything else, you need to invoke a draw, then a > copy a new background, and then proceed through the animation loop. > Also, be aware that zorder is not respected for animated artists, so I > think you will want to update and draw your image before the lines. > > JDH >
Thank you for the notes. I found that if I draw the image before the line, it works as expected. Even though you say I shouldn't try to change the viewlim when blitting, this does seem to work, the plot stays within bounds. The axes do not display the correct values until I resize the window (which forces a full redraw), but I can live with that. However, I am curious how one should achieve dynamic autoscaling while doing an animated plot. Doing a full draw each iteration is too slow. Is there any other way? Thanks again, Glenn ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users