-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: do not cache canvas object #13606
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
Matplotlib may change the canvas object on a figure. It is better to ask the figure what its current canvas is rather than cache the one it has the first time you see it.
larsoner
left a comment
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.
LGTM marking for merge-when-green, thanks for the thorough investigation @tacaswell !
| # https://github.com/matplotlib/matplotlib/issues/30575 | ||
| monkeypatch.setattr(mne.viz.utils, "_BLIT_KWARGS", dict(useblit=False)) | ||
| monkeypatch.setattr(mne.viz._mpl_figure, "_BLIT_KWARGS", dict(useblit=False)) |
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.
@tacaswell I pushed a commit to remove the workaround...
| .. _Teon Brooks: https://github.com/teonbrooks | ||
| .. _Tharupahan Jayawardana: https://github.com/tharu-jwd | ||
| .. _Thomas Binns: https://github.com/tsbinns | ||
| .. _Thomas Caswell: https://tacaswell.github.io |
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.
... and add a changelog entry for you, pulled this URL from your GitHub profile hopefully it's good enough!
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!
Sorry for not following your contribution guidelines. We debugged this from the traceback you posted on the mpl issue during our weekly dev call and I squeezed in getting this PR open between the next set of meetings, some other work, and dinnertime!
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.
No problem, happy to push a quick commit to get this over the finish line! You did the hard work of debugging, much appreciated
|
🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪 |
* upstream/main: (23 commits) DOC: Add jupyterlite idea to roadmap (mne-tools#13620) MAINT: Use f-strings in test_import_nesting.py (mne-tools#13551) Improve docs for raw.to_data_frame (mne-tools#13590) Sensitivity map doc improved (mne-tools#13578) [pre-commit.ci] pre-commit autoupdate (mne-tools#13612) MAINT: Fix for latest SciPy (mne-tools#13613) Fix pre-commit call in SPEC0 action [ci skip] (mne-tools#13609) MAINT: Add mne-denoise to CI dependencies (mne-tools#13607) FIX: do not cache canvas object (mne-tools#13606) FIX: Set calibration plot axes to screen resolution if available (mne-tools#13558) Refactoring eyetracking.py (mne-tools#13602) [pre-commit.ci] pre-commit autoupdate (mne-tools#13601) Follow up PR to PR - mne-tools#13596 (mne-tools#13599) FIX: Sphinx (mne-tools#13600) Doc improvement - Examples using <some-method> section quirk fix (mne-tools#13596) Add more information to eSSS in examples and docsstring (mne-tools#13591) np.fix -> np.trunc (deprecation) (mne-tools#13594) Make mne.sys_info() work with powershell 7+ (mne-tools#13593) BUG: Fix minor bug with T1 check (mne-tools#13588) [pre-commit.ci] pre-commit autoupdate (mne-tools#13587) ...
* upstream/main: (67 commits) DOC: Add jupyterlite idea to roadmap (mne-tools#13620) MAINT: Use f-strings in test_import_nesting.py (mne-tools#13551) Improve docs for raw.to_data_frame (mne-tools#13590) Sensitivity map doc improved (mne-tools#13578) [pre-commit.ci] pre-commit autoupdate (mne-tools#13612) MAINT: Fix for latest SciPy (mne-tools#13613) Fix pre-commit call in SPEC0 action [ci skip] (mne-tools#13609) MAINT: Add mne-denoise to CI dependencies (mne-tools#13607) FIX: do not cache canvas object (mne-tools#13606) FIX: Set calibration plot axes to screen resolution if available (mne-tools#13558) Refactoring eyetracking.py (mne-tools#13602) [pre-commit.ci] pre-commit autoupdate (mne-tools#13601) Follow up PR to PR - mne-tools#13596 (mne-tools#13599) FIX: Sphinx (mne-tools#13600) Doc improvement - Examples using <some-method> section quirk fix (mne-tools#13596) Add more information to eSSS in examples and docsstring (mne-tools#13591) np.fix -> np.trunc (deprecation) (mne-tools#13594) Make mne.sys_info() work with powershell 7+ (mne-tools#13593) BUG: Fix minor bug with T1 check (mne-tools#13588) [pre-commit.ci] pre-commit autoupdate (mne-tools#13587) ...
Matplotlib may change the canvas object on a figure. It is better to
ask the figure what its current canvas is rather than cache the one it has the
first time you see it.
Reference issue (if any)
This may address the new issues idenitfied in
matplotlib/matplotlib#30575
What does this implement/fix?
In mpl 3.11 we are being better about cleaning up GUI state on Figures when
they are closed. As part of this, when closed the canvas is replaced with a
base non-operative canvas. We think that because mne is caching the initial
GUI/Agg canvas the tear down callbacks are driving the figure to a chimera state
that is the source of the problems.
Additional information