On Fri, Jul 17, 2009 at 7:02 PM, John [H2O]<washa...@gmail.com> wrote: > > I have a script looping through and plotting 100's of figures. It runs fine, > but after the first few plots, the loop considerably slows down and the > memory usage keeps going up. > > The script is quite complicated, so can't really paste it here, but I am > trying to pass figure instances around and I am trying to reuse the > axes/figures... but maybe someone could demonstrate how this is done > efficiently?
You either need to close the figure in the loop, or reuse the same figure and cla it, eg for i in range(1000): fig = plt.figure() # plot something plt.close(fig) or explicitly reuse the same fig by giving a figure number and clearing it: for i in range(1000): fig = plt.figure(1) # plot something fig.cla() JDH ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users