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

[Doc]: add animation examples to show animated subplots #23909

Closed
@story645

Description

@story645

Documentation Link

https://matplotlib.org/devdocs/gallery/animation/index.html

Problem

Figured it'd be useful to have at least one example in the docs to show that it's possible and encourage the use of the OO paradigm. There used to be asubplot example, butthat was back when it was overly complicated to do animated subplots. it was removed in#10125

Suggested improvement

Add a new example showing how animation on subplots work. I originally thought of merging existing examples but they all feel overly complicated so I think this should be super simple, like 3 plots: sine/cosine/tangent and two lines each in the style ofhttps://matplotlib.org/devdocs/gallery/animation/simple_anim.html#sphx-glr-gallery-animation-simple-anim-py

I was thinking something like this, but if there's an easier or alternative, we should probably show that (too/instead of):

importnumpyasnpimportmatplotlib.pyplotaspltimportmatplotlib.animationasanimationfig, (ax1,ax2,ax3)=plt.subplots()x=np.arange(0,2*np.pi,0.01)line1,=ax1.plot(x,np.sin(x))line2,=ax2.plot(x,np.cos(x))line3,=ax3.plot(x,np.tan(x))defanimate(i):line1.set_ydata(np.sin(x+i/50))# update the data.line2.set_ydata(np.sin(x+i/50))line3.set_ydata(np.sin(x+i/50))return [line1,line2,line3]ani=animation.FuncAnimation(fig,animate,interval=20,blit=True,save_count=50)

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