DOC: simplify histogram animation example#27620
Conversation
story645
left a comment
There was a problem hiding this comment.
😄
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
animatefunction update the globalBarContainerobject.While I was in there I also
default_rng, per #25765(comment)PR checklist