Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

animation error #11602

Closed
Closed
@charliboy

Description

@charliboy

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp