-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Animation docs should include a simple "save as gif with pillow" example #22374
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
Comments
What we really need is an animation tutorial/explanation. This should explain the logic of animations and could then also have a section on saving to file. The individual examples should link to the tutorial for further information. |
Labeling good first issue because this is relatively simple and stand alone. Also agree we need a user level "how to animate" tutorial, but I think this example can be generated independent of that. |
This sounds interesting. Any suggestions on what animation we would want to use for this example? |
I think something small like moving a ETA: https://matplotlib.org/devdocs/gallery/animation/rain.html#sphx-glr-gallery-animation-rain-py has how to animate scatter, it's just the complex version |
No worries I'll have a look at it and try mock something up. |
Hey, Are we thinking something simple like this? (it moves faster and smoother when run from the terminal) Also what would be the best way we want to write the save to gif as? # To save the animation, use e.g.
#
# ani.save("movie.mp4")
#
# or
#
# writer = animation.FFMpegWriter(
# fps=15, metadata=dict(artist='Me'), bitrate=1800)
# ani.save("movie.mp4", writer=writer) Something like the above? Cheers, |
that works for me, except the save has to be explicitly using pillow as the writer and the two examples you have are the built in mp4 and ffmpeg. |
No worries I'll have a look into it and post the code block here. Thanks. |
How does this look? # To save the animation using Pillow as a gif, use e.g.
#
# writer = animation.PillowWriter(fps=15,
# metadata=dict(artist='Me'),
# bitrate=1800)
# ani.save('scatter.gif', writer=writer) |
I'm not sure if it needs to be in comments |
Sure thing I can uncomment in the code. |
@story645 just had a thought if it's not in comments when the docs are built will the code generate an image if it has Might be better to comment out then? |
Now that the animation tutorial has been merged, do we still need to keep this issue open? |
This is now covered in https://matplotlib.org/devdocs/users/explain/animations/animations.html#saving-animations |
Documentation Link
No response
Problem
pillow is the only animation writer that does not require additional dependencies (we already depend on pillow in any case) but it is not the default writer. I think the main animation formation it can save to is gif.
There should be a simple "save as gif with pillow example" with its own entry in https://matplotlib.org/devdocs/gallery/index#animation (although some of the examples have a few lines on saving as mp4 with ffmpeg, 1. it is not even clear from the index which are these examples, and 2. ffmpeg may or may not be present on the user's machine).
Suggested improvement
No response
Matplotlib Version
3.6.0.dev1512
The text was updated successfully, but these errors were encountered: