Skip to content

[Doc]: animation examples show controls; source does not reproduce them #24673

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

Closed
hmedina opened this issue Dec 9, 2022 · 1 comment · Fixed by #24897
Closed

[Doc]: animation examples show controls; source does not reproduce them #24673

hmedina opened this issue Dec 9, 2022 · 1 comment · Fixed by #24897
Milestone

Comments

@hmedina
Copy link

hmedina commented Dec 9, 2022

Documentation Link

https://matplotlib.org/stable/gallery/animation/simple_anim.html#sphx-glr-gallery-animation-simple-anim-py

Problem

The example gallery for animations includes rendered outputs. These include partial source code that generates the animated plot, but lack the code that generated the controls for said animation (e.g. pause/resume, next frame, path to the button icon).

These controls do not appear to be trivial additions, as discussed in #20564

In other words, running the source code that was provided produces output lacking non-trivial features found in the example.

Suggested improvement

I believe having these controls is a desirable feature, and so the source code should include the steps to reproduce said controls.

Alternatively, a new animation example should be made that shows the source to how the controls on every animation example were made.

@tacaswell
Copy link
Member

The controls in the built via the https://matplotlib.org/stable/api/_as_gen/matplotlib.animation.Animation.html#matplotlib.animation.Animation.to_jshtml method. The controls in the docs are more akin to the controls in a media player than part of a Matplotlib figure.

Given the confusion over this, I think we need to add a note to the built documentation linking to to_jshtml. The part of sphinx-gallery that extracts the animation is : https://github.com/sphinx-gallery/sphinx-gallery/blob/e2ecb35d9049d0df0a1db4f6d15be817745cd565/sphinx_gallery/scrapers.py#L216-L237 and the rst snippet is from https://github.com/sphinx-gallery/sphinx-gallery/blob/e2ecb35d9049d0df0a1db4f6d15be817745cd565/sphinx_gallery/scrapers.py#L80-L86 . I suspect the best thing to do is to add "output generate via :ref:matplotlib.animation.Animation.to_jshtml" or something to that effect (I can see trade offs between using the ref and asserting that intersphinx is working vs linking to a url in our docs) to sphinx-gallery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants