On Thursday 03 April 2008 05:52:28 pm Ted Drain wrote: > A few weeks ago I reported a double draw problem in the qt backends. They > both have a draw() method that looked like this: > > def draw( self ): > self.replot = True > FigureCanvasAgg.draw(self) > self.repaint( False ) > > It turned out that FCA::draw() and self.repaint() both did a draw which > slowed everything down. Commenting out the FCA draw call seemed to work > fine: > > def draw( self ): > self.replot = True > self.repaint( False ) > > However, this breaks when running code like this: > > import pylab as p > p.plot( [1,2,3] ) > p.savefig( 'image.png' ) > > The image is never drawn in this case. If you do a show() and save the > image from the gui, then everything is fine. I did some experimenting and > the solution may be to do this: > > def draw( self ): > self.replot = True > FigureCanvasAgg.draw(self) > > Which does seem to work for the cases I have. Could someone else take a > look and see if this doesn't break anything (You'll have to edit your local > backends, I haven't changed anything).
That change causes all kinds of problems with interactive plotting. I tested the following with ipython -pylab: a=rand(10,10) im=imshow(a) b=rand(10,10) im.set_data(b) draw() # nothing happens, lets start over a=rand(10,10) im=imshow(a) b=rand(10,10) im=imshow(b) # No change, lets close the window and try again im=imshow(b) # no figure is created show() # still no figure I reverted the changes, so we still have an unnecessary call to draw in some cases, but at least everything should work. Darren ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel