Skip to content

Commit cf4d812

Browse files
authored
Merge pull request #23742 from tacaswell/fix_ipympl
FIX: unbreak ipympl
2 parents 4355c4a + d791465 commit cf4d812

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

examples/user_interfaces/embedding_webagg_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
import matplotlib as mpl
33-
from matplotlib.backends.backend_webagg_core import (
33+
from matplotlib.backends.backend_webagg import (
3434
FigureManagerWebAgg, new_figure_manager_given_figure)
3535
from matplotlib.figure import Figure
3636

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ def set_history_buttons(self):
427427

428428

429429
class FigureManagerWebAgg(backend_bases.FigureManagerBase):
430-
_toolbar2_class = ToolbarCls = NavigationToolbar2WebAgg
430+
# This must be None to not break ipympl
431+
_toolbar2_class = None
432+
ToolbarCls = NavigationToolbar2WebAgg
431433

432434
def __init__(self, canvas, num):
433435
self.web_sockets = set()

lib/matplotlib/tests/test_backend_webagg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import pytest
5+
import matplotlib.backends.backend_webagg_core
56

67

78
@pytest.mark.parametrize("backend", ["webagg", "nbagg"])
@@ -25,3 +26,8 @@ def test_webagg_fallback(backend):
2526
ret = subprocess.call([sys.executable, "-c", test_code], env=env)
2627

2728
assert ret == 0
29+
30+
31+
def test_webagg_core_no_toolbar():
32+
fm = matplotlib.backends.backend_webagg_core.FigureManagerWebAgg
33+
assert fm._toolbar2_class is None

0 commit comments

Comments
 (0)