|
From: Benjamin R. <ben...@ou...> - 2013-08-23 18:25:10
|
On Fri, Aug 23, 2013 at 1:57 PM, Eric Firing <ef...@ha...> wrote: > On 2013/08/23 3:55 AM, Kari Aliranta wrote: > > Hello, fellow Matplotlib users, > > > > > > I'm embedding some Matplotlib figures into GUI (PyQt4) windows or widget > > canvases using qt4agg as the backend. I'm having problems with these > > figures popping up any time when some other part of the program calls > > pyplot.show(). > > Generally, when embedding, one simply does not use the pyplot interface > at all, so this sort of problem does not arise. Is there any reason why > you can't use this approach? > > > > How do you avoid this showing of previous figures? Is there some hidden > > buffer where the figures go? If there is, what is the way to clear this > > buffer, or preferably avoid putting figures in this buffer altogether? > > I'd be happy to handle these figures as simple individual objects. > > To remove a figure created by pyplot, use pyplot.close(fig); but still, > trying to use the pyplot interface for anything more complicated than > direct interactive use and simple non-interactive scripts is likely to > cause more problems than it solves. It's just not what pyplot is > designed for. > > Eric > I am wondering if the problem being described here is one where someone creates a module to do some particular thing using matplotlib, and someone else has the script that is using pyplot and that module. I am fairly certain that the pure OO approach should still work for the code in the module without interference from the script's usage of pyplot, though, but I am not 100% certain. Cheers! Ben Root |