Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: animation faster #24918

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

Merged
merged 3 commits into from
Jan 11, 2023
Merged

DOC: animation faster #24918

merged 3 commits into from
Jan 11, 2023

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Jan 9, 2023

PR Summary

The new animation tutorial takes over 30s to render in sphinx gallery on my machine. That seems unnecessary for didactic purposes. This version takes less than 5 s. Maybe someone wants different aesthetics, but this really is pretty slow.

@chahak13 I think you wrote the original. happy to defer to your interest in how this looks, but I still strongly encourage that it be much faster.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

@tacaswell tacaswell added this to the v3.7.0 milestone Jan 9, 2023
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducing the number of points is reasonable. However, with that, you only plot in a tiny fraction of the Axes, and the (somewhat complex) x-y relation does not become apparent.
I suggest to change the data as well, e.g. plot 36 points on a unit circle.

@jklymak
Copy link
Member Author

jklymak commented Jan 10, 2023

OK, changed this much more to something physical if trivial. Also did things like label the axes etc...

@jklymak jklymak force-pushed the doc-shorten-animation branch 2 times, most recently from 449a57c to a489512 Compare January 10, 2023 01:06
Comment on lines -104 to -107
# .set_offsets replaces the offset data for the entire collection with
# the new values. Therefore, to also carry forward the previously
# calculated information, we use the data from the first to the current
# frame to set the new offsets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like an explanation about why we take the entire data for the new frame should be there since this is a tutorial. Maybe reword it a little but not remove it completely?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it a bit. Note I also added comments for the steps where the data was added, which basically says what you are saying in the old text, so I think it's relatively clear? If not, happy to take suggestions.

@chahak13
Copy link
Contributor

The original idea was to not have something entirely trivial to show how to go about doing slightly more problem based, which is why I did not go for, say a unit circle. I'm happy with the projectile motion example that you added if it's making the doc load much faster :)

@jklymak jklymak force-pushed the doc-shorten-animation branch from a5535a6 to c14227b Compare January 11, 2023 00:48
@ksunden ksunden merged commit 66dd732 into matplotlib:main Jan 11, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 11, 2023
@jklymak
Copy link
Member Author

jklymak commented Jan 11, 2023

Thanks @ksunden

I think this was important to get in to keep the doc build reasonable. OTOH, @chahak13 or @story645 you are more than welcome to open a new PR to tweak the wording.

@jklymak jklymak deleted the doc-shorten-animation branch January 11, 2023 21:15
QuLogic added a commit that referenced this pull request Jan 12, 2023
…918-on-v3.7.x

Backport PR #24918 on branch v3.7.x (DOC: animation faster)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants