Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread Albert Kottke
Correct. On Tue, May 28, 2013 at 9:42 AM, zetah wrote: > Albert Kottke wrote: > > > >I had this problem as well. I think my solution was to tell the > >garbage collector to collect. > > > >import gc > >import numpy as np > >import matplotlib.pyplot as plt > > > >def draw_fig(arr, fn): > >fi

Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread zetah
Albert Kottke wrote: > >I had this problem as well. I think my solution was to tell the >garbage collector to collect. > >import gc >import numpy as np >import matplotlib.pyplot as plt > >def draw_fig(arr, fn): >fig = plt.figure() >ax = fig.add_subplot(111) >ax.contourf(arr) >plt.s

Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread Albert Kottke
I had this problem as well. I think my solution was to tell the garbage collector to collect. import gc import numpy as np import matplotlib.pyplot as plt def draw_fig(arr, fn): fig = plt.figure() ax = fig.add_subplot(111) ax.contourf(arr) plt.savefig(fn) plt.close(fig) gc

Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread zetah
"zetah" wrote: > >Eric Firing wrote: >> >>plt.close(fig) # that should take care of it > >Thanks for your quick reply. > >I tried before posting `plt.close()` and it didn't work, but also >`plt.close(fig)` doesn't change memory pumping with every loop. >BTW, I'm on Windows with Matplotlib

Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread zetah
Eric Firing wrote: > >plt.close(fig) # that should take care of it Thanks for your quick reply. I tried before posting `plt.close()` and it didn't work, but also `plt.close(fig)` doesn't change memory pumping with every loop. BTW, I'm on Windows with Matplotlib 1.2.1 -

Re: [Matplotlib-users] Memory usage when plotting sequental figures

2013-05-28 Thread Eric Firing
On 2013/05/27 9:51 PM, zetah wrote: > Hi, > > if I use something like this: > > == > import numpy as np > import matplotlib.pyplot as plt > > def draw_fig(arr, fn): > fig = plt.figure() > ax = fig.add_subplot(111) > ax.contourf(arr) >