On Fri, 02 Nov 2012 16:45:22 +0100,  
<matplotlib-users-requ...@lists.sourceforge.net> wrote:

> Message: 5
> Date: Fri, 2 Nov 2012 12:01:35 +0100
> From: Vlastimil Brom <vlastimil.b...@gmail.com>
> Subject: Re: [Matplotlib-users] Figures piling up in Tkinter GUI
>       (1.2.0rc2)
> To: matplotlib-users@lists.sourceforge.net
> Message-ID:
>       <cahzapeof6fexs32-us7_btddf8vc4fejr-a94s9uau16af-...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 2012/11/1 Hans Bering <hans.ber...@arcor.de>:
>> Hello everybody,
>>
>> I'm building a small Tkinter GUI using matplotlib, in which I have to
>> change/update plots quite often depending on user input (with different
>> contents & sizes, in different places in the GUI, etc.; but always only
>> one figure at a time).
>>
>> As a first resort, I regenerated the figures with plt.figure(...)  
>> whenever necessary; unfortunately, the program happily accumulated  
>> memory with
>> every new figure until the computer would no longer cooperate in a  
>> timely fashion. The following minimal script should demonstrate the  
>> tendency:
>>
> ...
>
> Hi,
> I'd recommend to use an embedded plot and only clear and replace its
> content [...]
> I only roughly adapted that source to use your function and the memory
> usage appears to be more effective (although there is some increase
> too - as displayed in Process Explorer). Would some variation of the
> following work for you?

[...]

Hi Vlastimil,

thanks for your effort; I had tried the approach of clearing & replacing  
the plot myself, too. Unfortunately, that approach has a different  
problem: Because of the figure's size, I have to present it with  
scrollbars, and clearing & reusing the plot does not seem to work when  
resizing & scrolling the plot. I had posted that problem as a question at  
Stackoverflow (as http://stackoverflow.com/questions/13197469 ), since I  
hoped it might be "easier"; i.e., just a misunderstanding on my part of  
how to wire together the scrollbars/canvas/figure. Please note that, while  
I also use plt.figure(...) in the post at Stackoverflow, the effect  
remains the same when using Figure(...) and ax.plot(...).

So basically I'm stuck between a rock and a hard place - I can either have  
the memory issue reported previously; or the plot won't behave properly  
with scrolling+resizing.

I am wondering: Should repeatedly creating Figures in a Tkinter GUI work,  
and could this be a Matplotlib bug worth mentioning on some bug tracker?

Thanks & Regards
Hans

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to