Render

This is done through rendering the figure first and then reload it in a FuncAnimation with imshow. Therefore the zoom function is limited to the resolution of the figure.

[ ]:
from smpl import animation
from smpl import plot
import matplotlib.pyplot as plt
import numpy as np
import tqdm

live-render

[ ]:
%matplotlib notebook
plt.ioff()
def update(a):
    plot.function(lambda x : a*x**2,xmin=0,xmax=5,init=True,tight=False)

ani = animation.animate(update = update,frames=np.linspace(0,10,200), interval=10,blit=True)
plt.show()

pre-render

[ ]:
%matplotlib notebook
plt.ioff()
for a in tqdm.tqdm(np.linspace(0,10,200)):
    plot.function(lambda x : a*x**2,xmin=0,xmax=5,init=True,tight=False)
    animation.frame()

#ani.save("test.gif")
ani = animation.animate(interval=10,blit=True)
plt.show()

Save

[ ]:
ani.save("test.gif")
[ ]:
from smpl import animation
from smpl import plot
import numpy as np

for a in np.linspace(0,10,200):
    plot.function(lambda x : a*x**2,xmin=0,xmax=5,init=True,tight=False)
    animation.frame()

ani = animation.animate(interval=10,blit=True)
ani.widget_gif()
[ ]:

[ ]:

[ ]: