-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup animation examples #10125
Conversation
8fa927f
to
6fe22f0
Compare
It is probably worth preserving an example of |
I think it is fair to require scipy to build the docs (but not in the library). |
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, fixed
examples/animation/dynamic_image2.py
Outdated
# or | ||
# | ||
# from matplotlib.animation import FFMpegWriter | ||
# writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be FFMpegWriter
or the above line should be ... as Writer
. Same for other files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
examples/animation/animate_decay.py
Outdated
|
||
if t >= xmax: | ||
ax.set_xlim(xmin, 2*xmax) | ||
ax.figure.canvas.draw() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
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. |
edb8bd2
to
a6d2aca
Compare
(going to let someone else review and merge since it involves removing stuff from the docs, but I'm 👍 ) |
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
a6d2aca
to
5f0a823
Compare
rebased |
Since life's too short to wait for a travis OSX build to complete on a doc PR, I'm going to merge this. |
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