Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
Bug report
the animation doesn't work
Bug summary
Code for reproduction
importnumpyasnp#import matplotlib#matplotlib.use('Agg')importmatplotlib.pyplotaspltimportmatplotlib.animationasanimationfrommpl_toolkits.axes_grid1importhost_subplotimportmpl_toolkits.axisartistasAAhost=host_subplot(111,axes_class=AA.Axes)fig=host.get_figure()plt.subplots_adjust(right=0.75)par1=host.twinx()par2=host.twinx()#fig, ax = plt.subplots()offset=60new_fixed_axis=par2.get_grid_helper().new_fixed_axispar2.axis["right"]=new_fixed_axis(loc="right",axes=par2,offset=(offset,0))par1.axis["right"].toggle(all=True)par2.axis["right"].toggle(all=True)host.set_xlabel("Distance")host.set_ylabel("Density")par1.set_ylabel("Temperature")par2.set_ylabel("Velocity")x=np.arange(0,2*np.pi,0.01)p1,=host.plot(x,np.sin(x),label="Density")p2,=par1.plot(x,np.cos(x),label="Temperature")p3,=par2.plot(x,np.tan(x),label="Velocity")#line, = ax.plot(x, np.sin(x))definit():# only required for blitting to give a clean slate.p1.set_ydata([np.nan]*len(x))p2.set_ydata([np.nan]*len(x))p3.set_ydata([np.nan]*len(x))returnp1,p2,p3defanimate(i):#line.set_ydata(np.sin(x + i / 100)) # update the data.p1.set_ydata(np.sin(x+i/100))p2.set_ydata(np.cos(x+i/100))p3.set_ydata(np.tan(x+i/100))returnp1,p2,p3ani=animation.FuncAnimation(fig,animate,init_func=init,interval=2,blit=True,save_count=50)# To save the animation, use e.g.## ani.save("movie.mp4")## or## from matplotlib.animation import FFMpegWriter# writer = FFMpegWriter(fps=15, metadata=dict(artist='Me'), bitrate=1800)# ani.save("movie.mp4", writer=writer)plt.show()
Actual outcome
not work
Process finished with exit code 1
# If applicable, paste the console output here##
Expected outcome
Matplotlib version
- Operating system:
- Matplotlib version:
- Matplotlib backend (
print(matplotlib.get_backend())
): - Python version:
- Jupyter version (if applicable):
- Other libraries: