-
Notifications
You must be signed in to change notification settings - Fork 207
matplotlib animations support #150
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
I am not sure how easy it is for us to do. My instinct is why not but it is not that crucial, in general you can select a few static plots that are as clear as an animated gif. |
I'll try to implement it for matplotlib animation in general (.git or .mp4). I'll keep you informed. |
One of the technical hurdle I can see: after running the example we get the list of figures opened by matplotlib and save each of them (look at save_figures in gen_rst.py for more details). It seems like for matplotlib animations you need to call .save on the matplotlib.Animation object instead. |
I haven't used animation. But if is a different object, you should be able to write a new function(as we do for mayavi figures) an make it part of the chain. |
@lesteve Yes, I think I will add an @Titan-C ok, I'll keep this in mind. I can't work on it right now, but I will spend some time on it this week, so it may progress slowly :) |
In general, it would be super useful for matplotlib to be able to display animation, so we would greatly appreciate this addition to |
@NelleV here is the code we use to find all the matplotlib figures that have been generated by the example and save each of them: sphinx-gallery/sphinx_gallery/gen_rst.py Line 323 in 47f7149
I am not a matplotlib expert at all, so here is a naive question: is there a way from the figure object to know that a matplotlib.Animation object was used to plot on this figure? |
There is an animation object. |
I really need this feature. For the docs that I'm currently working on, every single example is an animation. A file of the name |
#313 would make this easier presumably because you could write your own scraper |
note that #313 has been merged now, it'd be useful if somebody could give a shot at this with gifs! |
I'm just waiting on a release. |
@t-makaro is an experimental feature, you are better of giving it a try on the git version. And check what is possible and what still needs to be done. |
That's an awful lot of extra work to experiment with something that I won't yet be able to use. My docs are built with readthedocs, so I'm not sure that I could (or even should) get rtd to build with a dependency from git. Also, my gallery is currently built with nbsphinx, so I don't want to end up maintaining 2 galleries until this is released. I may try to experiment a little with this on the weekend, and I could report back on my success, but even a beta release would be greatly helpful. |
Does it make it easier to experiment knowing you can
? |
Yes, yes that might. Thank you. |
@t-makaro please do share thoughts on how this works for you if you give it a shot! |
So, I've been trying to modify the "naïve scrapper" to grab gifs. https://sphinx-gallery.readthedocs.io/en/latest/configuration.html#image-scrapers The first issues that I've been having are:
should be
This is also a mismatched parathesis on the example on the docs. I can't get the example to work in any shape or form. My build fails at:
|
Good catch @t-makaro ...it looks like we need to update the documentation there. Maybe @larsoner has a moment to make sure that the suggested code there works? I wonder if creating a scraper is advanced enough that it could use its own section in the |
It sounds like @t-makaro has already figure out the necessary fixes to at least remove the errors, can you make a PR? |
I have no idea what caused the pickling error (it occurred with both the function and the class). Is there any place that I should put my image scraper? I was just temporarily placing it in my conf.py to try to get something to work, but there must be a proper place. I'm still new to sphinx. |
@larsoner if you're +1 to the idea then I can make a PR! |
Yeah go ahead |
Coming back to this because I have a couple of use cases that could benefit from native sphinx-gallery support for Matplotlib animations. Has anyone written a scraper yet? I noticed the It seems like using the
where |
Hmmmm - I'm not sure how the MPL devs would feel about it, though in general they've been pretty receptive to improvements like this as long as it gives them the flexibility to keep the customizations they want. I'd be +1 on this (maybe with some warning about YMMV, since I could see this becoming a rabbit-hole) |
Indeed, the idea wouldn't be to cover all |
That would be nice to support GIF images, like in this example: http://eli.thegreenplace.net/2016/drawing-animated-gifs-with-matplotlib/
The text was updated successfully, but these errors were encountered: