-
Notifications
You must be signed in to change notification settings - Fork 207
ENH: Add support for FuncAnimation #687
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
Conversation
And here are our built docs: |
Bumping AppVeyor to 3.6 from 3.5. The matplotlib for 3.5 appears to be too old to support animations without bugs. 3.5 is already tested on Travis anyway, and we'll probably kill support soon anyway (EOL in August) so this seems like the easiest solution. |
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.
You're a wizard Eric! 🧙
It looks quite nice to me - a few comments in there. The GIF even works in the thumbnail! So cool! https://1535-25860190-gh.circle-artifacts.com/0/rtd_html/auto_examples/index.html
sphinx_gallery/scrapers.py
Outdated
# if it's the file thumbnail | ||
fig = ani._fig | ||
image_path_iterator = block_vars['image_path_iterator'] | ||
img_fname = next(image_path_iterator).replace('.png', '.gif') |
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.
We should really relax the assumptions about .png
extensions in the codebase :-)
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.
Someday probably :) But in the meantime, knowing it ends with png
and .replace
ing works okay
sphinx_gallery/scrapers.py
Outdated
if ImageMagickWriter.isAvailable(): | ||
writer = 'imagemagick' | ||
else: | ||
writer = None |
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.
Do we assume this will default to FFmpeg then? And if we know it's buggy, maybe we raise a warning here about this?
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 don't know enough about matplotlib to know what all the options are, or if FFmpeg can be fixed to work better than it did in my original testing. So I'd rather not emit a warning unless someone with expertise can comment.
LGTM but it's unfamiliar territory for me. |
Codecov Report
@@ Coverage Diff @@
## master #687 +/- ##
==========================================
+ Coverage 97.77% 97.79% +0.01%
==========================================
Files 31 32 +1
Lines 3288 3405 +117
==========================================
+ Hits 3215 3330 +115
- Misses 73 75 +2
Continue to review full report at Codecov.
|
@choldgraf feel free to merge if you're happy |
I'm happy! |
thumb_size = gallery_conf['thumbnail_size'] | ||
use_dpi = round( | ||
min(t_s / f_s for t_s, f_s in zip(thumb_size, fig_size))) | ||
# FFmpeg is buggy for GIFs |
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.
Might want to see matplotlib/matplotlib#18093
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.
@dopplershift would you be up for making a quick PR to triage based on the LooseVersion
of matplotlib which backend to use?
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.
Sure. #733
Closes #150.
@choldgraf @lucyleeow do you want to take a first look at these? Once you're happy I'll ping the folks from #150 to take a look. (Anyone else can feel free to comment as well, just don't want to spam everyone if this is still half-baked/experimental!) But at least it seems to work for MNE-Python:
They both show animations when built with this branch.