Skip to content

Commit 08ef1c7

Browse files
authored
MAINT: Reenable mpl nightly (#13426)
1 parent 936bfae commit 08ef1c7

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

mne/preprocessing/tests/test_fine_cal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def test_fine_cal_systems(system, tmp_path):
242242
err_limit = 15
243243
int_order = 5
244244
corrs = (0.13, 0.0, 0.12)
245-
sfs = [4, 5, 125, 157]
245+
sfs = [4, 5, 125, 159]
246246
corr_tol = 0.38
247247
else:
248248
assert system == "triux", f"Unknown system {system}"

mne/viz/_mpl_figure.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from ..utils import Bunch, _click_ch_name, check_version, logger
6060
from ._figure import BrowserBase
6161
from .utils import (
62+
_BLIT_KWARGS,
6263
DraggableLine,
6364
_events_off,
6465
_fake_click,
@@ -1129,9 +1130,9 @@ def _create_annotation_fig(self):
11291130
self._select_annotation_span,
11301131
"horizontal",
11311132
minspan=0.1,
1132-
useblit=True,
11331133
button=1,
11341134
props=dict(alpha=0.5, facecolor=col),
1135+
**_BLIT_KWARGS,
11351136
)
11361137
self.mne.ax_main.selector = selector
11371138
self.mne._callback_ids["motion_notify_event"] = self.canvas.mpl_connect(
@@ -1170,7 +1171,7 @@ def _update_annotation_fig(self, *, draw=True):
11701171
ax.set_title(title, size=None, loc="left")
11711172
if len(labels):
11721173
if _OLD_BUTTONS:
1173-
ax.buttons = RadioButtons(ax, labels)
1174+
ax.buttons = RadioButtons(ax, labels, **_BLIT_KWARGS)
11741175
radius = 0.15
11751176
circles = ax.buttons.circles
11761177
for circle, label in zip(circles, ax.buttons.labels):
@@ -1195,7 +1196,9 @@ def _update_annotation_fig(self, *, draw=True):
11951196
edgecolor=edgecolors,
11961197
facecolor=facecolors,
11971198
)
1198-
ax.buttons = RadioButtons(ax, labels, radio_props=radio_props)
1199+
ax.buttons = RadioButtons(
1200+
ax, labels, radio_props=radio_props, **_BLIT_KWARGS
1201+
)
11991202
else:
12001203
ax.buttons = None
12011204
# adjust xlim to keep equal aspect & full width (keep circles round)
@@ -1471,7 +1474,9 @@ def _create_selection_fig(self):
14711474
labels = list(selections_dict)
14721475
# make & style the radio buttons
14731476
activecolor = to_rgb(self.mne.fgcolor) + (0.5,)
1474-
radio_ax.buttons = RadioButtons(radio_ax, labels, activecolor=activecolor)
1477+
radio_ax.buttons = RadioButtons(
1478+
radio_ax, labels, activecolor=activecolor, **_BLIT_KWARGS
1479+
)
14751480
fig.mne.old_selection = 0
14761481
if _OLD_BUTTONS:
14771482
for circle in radio_ax.buttons.circles:

mne/viz/tests/test_raw.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,16 @@ def test_scale_bar(browser_backend):
318318
assert_allclose(y_lims, bar_lims, atol=1e-4)
319319

320320

321-
def test_plot_raw_selection(raw, browser_backend):
321+
def test_plot_raw_selection(raw, browser_backend, monkeypatch):
322322
"""Test selection mode of plot_raw()."""
323323
ismpl = browser_backend.name == "matplotlib"
324324
with raw.info._unlock():
325325
raw.info["lowpass"] = 10.0 # allow heavy decim during plotting
326326
browser_backend._close_all() # ensure all are closed
327327
assert browser_backend._get_n_figs() == 0
328+
# https://github.com/matplotlib/matplotlib/issues/30575
329+
monkeypatch.setattr(mne.viz.utils, "_BLIT_KWARGS", dict(useblit=False))
330+
monkeypatch.setattr(mne.viz._mpl_figure, "_BLIT_KWARGS", dict(useblit=False))
328331
fig = raw.plot(group_by="selection", proj=False)
329332
assert browser_backend._get_n_figs() == 2
330333
sel_fig = fig.mne.fig_selection
@@ -493,10 +496,13 @@ def test_plot_raw_child_figures(raw, browser_backend):
493496
fig._resize_by_factor(0.5)
494497

495498

496-
def test_orphaned_annot_fig(raw, browser_backend):
499+
def test_orphaned_annot_fig(raw, browser_backend, monkeypatch):
497500
"""Test that annotation window is not orphaned (GH #10454)."""
498501
if browser_backend.name != "matplotlib":
499502
return
503+
# https://github.com/matplotlib/matplotlib/issues/30575
504+
monkeypatch.setattr(mne.viz.utils, "_BLIT_KWARGS", dict(useblit=False))
505+
monkeypatch.setattr(mne.viz._mpl_figure, "_BLIT_KWARGS", dict(useblit=False))
500506
assert browser_backend._get_n_figs() == 0
501507
fig = raw.plot()
502508
_spawn_child_fig(fig, "fig_annotation", browser_backend, "a")

mne/viz/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
from ..utils.misc import _identity_function
6161
from .ui_events import ChannelsSelect, ColormapRange, publish, subscribe
6262

63+
_BLIT_KWARGS = dict(useblit=True)
64+
6365
_channel_type_prettyprint = {
6466
"eeg": "EEG channel",
6567
"grad": "Gradiometer",
@@ -1691,7 +1693,10 @@ def __init__(
16911693

16921694
# Initialize the lasso selector
16931695
self.lasso = LassoSelector(
1694-
ax, onselect=self.on_select, props=dict(color="red", linewidth=0.5)
1696+
ax,
1697+
onselect=self.on_select,
1698+
props=dict(color="red", linewidth=0.5),
1699+
**_BLIT_KWARGS,
16951700
)
16961701
self.selection = list()
16971702
self.selection_inds = np.array([], dtype="int")

tools/install_pre_requirements.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ python -m pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 \
3232
"tables>=3.10.3.dev0" \
3333
"statsmodels>=0.15.0.dev697" \
3434
"pyarrow>=22.0.0.dev0" \
35+
"matplotlib>=3.11.0.dev0" \
3536
"h5py>=3.13.0"
3637
echo "::endgroup::"
37-
# https://github.com/matplotlib/matplotlib/issues/30575
38-
# "matplotlib>=3.11.0.dev0" \
3938
# No Numba because it forces an old NumPy version
4039

4140
echo "::group::VTK"
@@ -50,10 +49,10 @@ python -m pip install $STD_ARGS \
5049
"git+https://github.com/nilearn/nilearn" \
5150
"git+https://github.com/pierreablin/picard" \
5251
https://gitlab.com/obob/pymatreader/-/archive/master/pymatreader-master.zip \
53-
git+https://github.com/mne-tools/mne-qt-browser \
54-
git+https://github.com/mne-tools/mne-bids \
55-
git+https://github.com/nipy/nibabel \
56-
git+https://github.com/joblib/joblib \
52+
git+https://github.com/mne-tools/mne-qt-browser \
53+
git+https://github.com/mne-tools/mne-bids \
54+
git+https://github.com/nipy/nibabel \
55+
git+https://github.com/joblib/joblib \
5756
git+https://github.com/h5io/h5io \
5857
git+https://github.com/BUNPC/pysnirf2 \
5958
git+https://github.com/the-siesta-group/edfio \

0 commit comments

Comments
 (0)