Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
story645 merged 2 commits intomatplotlib:mainfromrcomer:doc-hist-anim
Jan 9, 2024

Conversation

rcomer
Copy link
Member

@rcomerrcomer commentedJan 9, 2024
edited
Loading

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 ouranimate function update the globalBarContainer object.

While I was in there I also

  • Updated to use numpy'sdefault_rng, per#25765(comment)
  • Made punctuation more consistent through the comments

PR checklist

@rcomerrcomer added the Documentation: examplesfiles in galleries/examples labelJan 9, 2024
@rcomerrcomer added this to thev3.8-doc milestoneJan 9, 2024
story645
story645 previously approved these changesJan 9, 2024
Copy link
Member

@story645story645 left a 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

@dstansby
Copy link
Member

This can be merged if/when CI passes.

@rcomer
Copy link
MemberAuthor

Renders like this

The animation is no longer showing in the built docs, just a static image. Any ideas how I broke that?

@rcomerrcomer marked this pull request as draftJanuary 9, 2024 16:17
@story645
Copy link
Member

story645 commentedJan 9, 2024
edited
Loading

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 functionhttps://matplotlib.org/devdocs/gallery/animation/animated_histogram.html#sphx-glr-gallery-animation-animated-histogram-py

rcomer reacted with thumbs up emoji

@story645story645 dismissed theirstale reviewJanuary 9, 2024 16:30

oops, guess wrapper was important

@rcomer
Copy link
MemberAuthor

Thanks@story645 I have moved the figure and artists setup back to the last cell andthe 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.

story645 reacted with thumbs up emoji

@rcomerrcomer marked this pull request as ready for reviewJanuary 9, 2024 17:14
@story645
Copy link
Member

story645 commentedJan 9, 2024
edited
Loading

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:
https://matplotlib.org/devdocs/api/_as_gen/matplotlib.animation.FuncAnimation.html#matplotlib.animation.FuncAnimation

But also not a blocker, current globals is fine too/ I can do as follow up.

@rcomer
Copy link
MemberAuthor

demo how we can pass arguments to animation update functions using partial

I like this. It feels more intuitive given the order of cells in the example. Also we already have theline animation to demonstrate the absolute simplest way of doing it.

story645 reacted with laugh emoji

@story645story645 merged commit83aa3e4 intomatplotlib:mainJan 9, 2024
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 9, 2024
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 9, 2024
QuLogic added a commit that referenced this pull requestJan 9, 2024
…620-on-v3.8.xBackport PR#27620 on branch v3.8.x (DOC: simplify histogram animation example)
QuLogic added a commit that referenced this pull requestJan 9, 2024
…620-on-v3.8.2-docBackport PR#27620 on branch v3.8.2-doc (DOC: simplify histogram animation example)
@rcomerrcomer deleted the doc-hist-anim branchJanuary 10, 2024 10:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
Documentation: examplesfiles in galleries/examples
Projects
None yet
Milestone
v3.8-doc
Development

Successfully merging this pull request may close these issues.

3 participants
@rcomer@dstansby@story645

[8]ページ先頭

©2009-2025 Movatter.jp