-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Example for FuncAnimation, passing args to animation guide #27675
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
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.
Hi, thanks for this PR! We already have an example of passing arguments https://matplotlib.org/devdocs/gallery/animation/animated_histogram.html#sphx-glr-gallery-animation-animated-histogram-py but I think that example may be more of a small tutorial than an example; therefore I'm not opposed to adding this, especially since it's also an example of animating text, once changes are made.
To help you resolve the flake errors, I strongly recommend that you install the precommit hooks:
https://matplotlib.org/devdocs/devel/development_setup.html#install-pre-commit-hooks
That being said, my issue request was for adding a second small example to https://matplotlib.org/devdocs/users/explain/animations/animations.html#funcanimation showing a parameterized update function.
Thank you for feedback, so the issue was to just create an example/ tutorial for the update function my mistake.. |
It was to add a "passing arguments" subsection to the FuncAnimate section of the Animation User Guide: |
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.
Tiny formatting convention but otherwise this is looking really good! Thanks 😄
To clean up the PR cleanliness error, I think you'll have to rebase https://matplotlib.org/devdocs/devel/development_workflow.html#rewrite-commit-history
Let me know if you need help w/ that.
I'm sorry, but what is the purpose of the example? As far as I understood #27621 was requesting additions to https://matplotlib.org/devdocs/users/explain/animations/animations.html#animations. |
Yeah, but honestly that issue is superceded by #27687 anyway Reason I was letting this PR go through anyway though was b/c we don't have an explicit "how to pass arguments to animation function" example (one's kinda buried in the histogram example that's more a tutorial) and this one felt pretty clean and straightforward. |
54a914f
to
e2c578c
Compare
thank you for your help, the workflows seem very intimidating definitely need help with rebasing |
9c29c02
to
187341c
Compare
@vamshipy just pushed a rebase and also made some edits to make the example more concise. I'm gonna leave this PR for someone else to review b/c I don't feel comfortable merging on just my approval given the extent of the changes I've made to this PR. |
187341c
to
69f6932
Compare
I understand, is there something I have to do about the labeler error |
No, that's a bug on our end. Do you have any comments/changes you'd like to suggest on top of my changes? |
Co-authored-by: hannah <story645@gmail.com>
69f6932
to
0070ad8
Compare
I'm unclear when why one should pass arguments to the animation function. Other examples achieve the same as here by reusing variables from the outer scope. While knowing and relying on the scoping is possibly not trivial, it just works for the usual cases. It's not necessarily conceptually simpler/better to rely on a partial closure. If we want to add this, I'd like to see an explanation why one would want to use partial and how it works.
With four parameters passed to |
Added a file to show how args are passed to FuncAnimation to create a graph
PR summary
Fixes #27621
PR checklist