| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I had actually been wondering if there’s a reason we didn’t have this. I think the common use case would be to fix the levels and update the data, so I agree there is no need to support updating levels here. |
Sorry, something went wrong.
There was a problem hiding this comment.
Nice, I have also desired this capability.
Sorry, something went wrong.
|
Thanks for the review @greglucas , I pushed a commit and think I addressed your comments! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR summary
Covering the actual use case for MNE-Python I was investigating when I hit #32264 : needing to update contours inside an animation. This PR adds ContourSet.set_data so that contours can be blitted properly rather than removed and readded.
This is really "issue as PR" -- I wasn't sure how many lines of code would be needed to make it work, so I figured I'd just check by implementing the changes... So I'm happy to close if this isn't wanted or refactor heavily if there is a better way, etc. It didn't end up being so bad since _process_args could be reused -- most of the new lines are unit tests actually. Related issues:
One intentional omission is support for setting levels. I think that should be a follow-up PR if desired -- it interacts with colorbars etc. which is a harder problem. (And maybe should be solved more generally with a .set_levels instead!) Also fixes a small TriContour bug I encountered when adding a **kwargs check (see lib/matplotlib/tri/_tricontour.py). I also added a helper to reset the object state in case the set_data fails after some attributes are already set (which can happen inside _process_args), put in cbook so that other Artists could potentially use it down the line.
AI Disclosure
I had Claude Opus 5 draft the code changes. I iterated through them until it looked like what I would have produced on my own (with better/more complete testing actually).
PR quality check