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

Cleanup animation examples#10125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dstansby merged 2 commits intomatplotlib:masterfromanntzer:anim-examples
Jan 17, 2018
Merged

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedDec 29, 2017
edited
Loading

I thought that the animation examples section was a bit of an unstructured mess so I tried to reorganize it somewhat. The suggested new list of examples (open to discussion, of course) is

simple examples

animation_demo: plt.pause example
simple_anim: FuncAnimation example
dynamic_image: FuncAnimation example
dynamic_image2: ArtistAnimation example

intermediate examples

strip_chart: FuncAnimation example

advanced examples

histogram: animating a composite artist (namely, a histogram)

nice examples

bayes: FuncAnimation example
double_pendulum: FuncAnimation example, skipped as needing scipy
random_walk (renamed from simple_3danim): FuncAnimation example
rain: FuncAnimation example
unchained: FuncAnimation example

movie writing

frame_grabbing_sgskip (renamed from moviewriter_sgskip.py)

removed

animate_decay: overlaps with simple_anim
basic_example: equivalent to {simple_anim + dynamic_image2}
basic_example_writer_sgskip: split as comments to
simple_anim/dynamic_image/dynamic_image2
random_data: overlaps with simple_anim, though using a generator
subplots: relies on subclassing private attributes of TimedAnimation, would
better be replaced by a FuncAnimation example, overly complex


It would be nice if s-g allowed for an easier way to set the example order, but that's for another time...

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzerforce-pushed theanim-examples branch 6 times, most recently from8fa927f to6fe22f0CompareDecember 29, 2017 06:48
@tacaswelltacaswell added this to thev2.2 milestoneDec 31, 2017
@tacaswell
Copy link
Member

It is probably worth preserving an example ofFuncAnimation that uses a generator.

@tacaswell
Copy link
Member

I think it is fair to require scipy to build the docs (but not in the library).

defanimate(i):
line.set_ydata(np.sin(x + i/10.0)) # update the data
definit(): # only required for blitting to give a clean slate.
line.set_ydata(x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This sets the initial data to be a line?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

good catch, fixed

# or
#
# from matplotlib.animation import FFMpegWriter
# writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should beFFMpegWriter or the above line should be... as Writer. Same for other files.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixed


if t >= xmax:
ax.set_xlim(xmin, 2*xmax)
ax.figure.canvas.draw()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This one shows how to force a change to the limits in the update function, is that shown else where still?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I decided to retsore the example (also showcasing the use of a generator as you mentioned above) and remove dynamic_image instead (renaming dynamic_image2 (ArtistAnimation) to it).

@anntzer
Copy link
ContributorAuthor

Re: scipy: I rewrote bayes to not use scipy (it's not the end of the world to write the beta pdf). double pendulum needs an ode solver, but it's not as if s-g can show animations anyways so I think it's fine to leave it as sgskipped.

@anntzeranntzerforce-pushed theanim-examples branch 4 times, most recently fromedb8bd2 toa6d2acaCompareJanuary 2, 2018 00:51
@dstansby
Copy link
Member

(going to let someone else review and merge since it involves removing stuff from the docs, but I'm 👍 )

@dopplershift
Copy link
Contributor

Of course, now there's a conflict.

I thought that the animation examples section was a bit of anunstructured mess so I tried to reorganize it somewhat.  The new list ofexamples issimple examples===============animation_demo: plt.pause examplesimple_anim: FuncAnimation exampledynamic_image: FuncAnimation exampledynamic_image2: ArtistAnimation exampleintermediate examples=====================strip_chart: FuncAnimation exampleadvanced examples=================histogram: animating a composite artist (namely, a histogram)nice examples=============bayes: FuncAnimation exampledouble_pendulum: FuncAnimation example, skipped as needing scipyrandom_walk (renamed from simple_3danim): FuncAnimation examplerain: FuncAnimation exampleunchained: FuncAnimation examplemovie writing=============frame_grabbing_sgskip (renamed from moviewriter_sgskip.py)removed=======animate_decay: overlaps with simple_animbasic_example: equivalent to {simple_anim + dynamic_image2}basic_example_writer_sgskip: split as comments to  simple_anim/dynamic_image/dynamic_image2random_data: overlaps with simple_anim, though using a generatorsubplots: relies on subclassing private attributes of TimedAnimation, would  better be replaced by a FuncAnimation example, overly complex
@anntzer
Copy link
ContributorAuthor

rebased

@dstansby
Copy link
Member

Since life's too short to wait for a travis OSX build to complete on a doc PR, I'm going to merge this.

@dstansbydstansby merged commitf4bcca3 intomatplotlib:masterJan 17, 2018
@anntzeranntzer deleted the anim-examples branchJanuary 18, 2018 00:57
@QuLogicQuLogic removed this from theneeds sorting milestoneFeb 12, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@dopplershiftdopplershiftdopplershift approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v2.2.0
Development

Successfully merging this pull request may close these issues.

5 participants
@anntzer@tacaswell@dstansby@dopplershift@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp