|
From: zetah <ot...@hu...> - 2013-05-28 07:51:24
|
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)
plt.savefig(fn)
if __name__ == '__main__':
for i in range(10):
draw_fig(np.random.random((10, 10)), 'fig_%02d.png' % i)
==================================================
memory usage grows with every loop, so I can't plot this way many sequences.
I know there is animation class in Matplotlib, but this way is easier to me, and I think I miss something fundamental because this is happening. How can I avoid memory leak using this approach?
Thanks
|