FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Cleanup animation examples by anntzer · Pull Request #10125 · matplotlib/matplotlib · GitHub

Repository navigation

Cleanup animation examples - #10125

Merged
dstansby merged 2 commits into
matplotlib:masterfrom
anntzer:anim-examples
Jan 17, 2018
Merged

dstansby merged 2 commits into
matplotlib:masterfrom
anntzer:anim-examples

Conversation

anntzer commented Dec 29, 2017 •
edited
Loading

Copy link
Copy Markdown
Contributor

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

anntzer force-pushed the anim-examples branch 6 times, most recently from 8fa927f to 6fe22f0 Compare December 29, 2017 06:48
tacaswell added this to the v2.2 milestone Dec 31, 2017

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Comment thread examples/animation/simple_anim.py Outdated
def animate(i):
line.set_ydata(np.sin(x + i/10.0)) # update the data
def init(): # only required for blitting to give a clean slate.
line.set_ydata(x)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This sets the initial data to be a line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

good catch, fixed

Comment thread examples/animation/dynamic_image2.py Outdated
# or
#
# from matplotlib.animation import FFMpegWriter
# writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

fixed


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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 commented Jan 1, 2018

Copy link
Copy Markdown
Contributor Author

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.

anntzer force-pushed the anim-examples branch 4 times, most recently from edb8bd2 to a6d2aca Compare January 2, 2018 00:51

dstansby commented Jan 9, 2018

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor

Of course, now there's a conflict.

I thought that the animation examples section was a bit of an
unstructured mess so I tried to reorganize it somewhat.  The new list of
examples 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

anntzer commented Jan 17, 2018

Copy link
Copy Markdown
Contributor Author

rebased

Copy link
Copy Markdown
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.

dstansby merged commit f4bcca3 into matplotlib:master Jan 17, 2018
anntzer deleted the anim-examples branch January 18, 2018 00:57
QuLogic removed this from the needs sorting milestone Feb 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL