Re: [Python-Dev] [IPython-User] proper animation in notebook?

On Sat, Oct 11, 2014 at 4:07 AM, Steve Holden <steve@holdenweb.com> wrote:
I found the following code appeared to work without any issues:
%matplotlib inline import numpy as np import matplotlib.pyplot as plt
import sys import time from IPython.display import display, clear_output
x=np.linspace(0,6,100) for t in np.linspace(0,20,100): clear_output(wait=True) f=plt.figure(figsize=(10,10)) plt.plot(np.sin(x)*np.sin(t),'-o') plt.gca().set_ylim([-1,1]) display(f) plt.close()
Further queries should be sent to the python-dev list, as this one is being phased out.
Running this code makes a working animation, but watching the memory usage of the python2.7 process it is clear there is a memory leak - it starts around 150 M and climbs to 300 M. Running for longer keeps this going. I think the figures are being generated, cleared in the notebook, but still existing somehow in the background. Is there a way to determine if this is happening? Is there a proper way to write the animation to avoid this? thanks! Brian Blais ----------------- bblais@gmail.com http://web.bryant.edu/~bblais
participants (1)
-
Brian Blais