-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: simplify histogram animation example #27620
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
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.
😄
Can't decide if helpful or out of scope to also show updating a histogram using ArtistAnimation
This can be merged if/when CI passes. |
The animation is no longer showing in the built docs, just a static image. Any ideas how I broke that? |
So my guess is that the reason for the wrapper function is b/c otherwise sphinx gallery is losing the figure/global that's in the other cell. 🤦♀️ yeah, see how in the current the figure is created in the same block as the call to the animation function https://matplotlib.org/devdocs/gallery/animation/animated_histogram.html#sphx-glr-gallery-animation-animated-histogram-py |
Thanks @story645 I have moved the figure and artists setup back to the last cell and the animation works again. I think it is a bit less intuitive this way round, but still good to remove the unnecessary complication of the wrapper function. |
So I just realized this could maybe be a good place to demo how we can pass arguments to animation update functions using partial: But also not a blocker, current globals is fine too/ I can do as follow up. |
I like this. It feels more intuitive given the order of cells in the example. Also we already have the line animation to demonstrate the absolute simplest way of doing it. |
…620-on-v3.8.x Backport PR #27620 on branch v3.8.x (DOC: simplify histogram animation example)
…620-on-v3.8.2-doc Backport PR #27620 on branch v3.8.2-doc (DOC: simplify histogram animation example)
PR summary
I might be missing something but the function-returning-a-function approach used here seems unnecessarily complicated to me. We can just have our
animate
function update the globalBarContainer
object.While I was in there I also
default_rng
, per #25765(comment)PR checklist