Skip to content

Commit

Permalink
Use newer ipympl package for drawing matplotlib figures into a notebo…
Browse files Browse the repository at this point in the history
  • Loading branch information
wmvanvliet authored Sep 7, 2023
1 parent 3dd8899 commit 33d5db7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mne/viz/backends/_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
_take_3d_screenshot, # noqa: F401
)
from ._utils import _notebook_vtk_works
from ...utils import check_version
from ...utils import check_version, _soft_import


# dict values are icon names from: https://fontawesome.com/icons
Expand Down Expand Up @@ -1346,10 +1346,9 @@ def _playback_initialize(self, func, timeout, value, rng, time_widget, play_widg

class _IpyMplInterface(_AbstractMplInterface):
def _mpl_initialize(self):
from matplotlib.backends.backend_nbagg import FigureCanvasNbAgg, FigureManager

self.canvas = FigureCanvasNbAgg(self.fig)
self.manager = FigureManager(self.canvas, 0)
ipympl = _soft_import("ipympl", "Drawing figures into a notebook.", strict=True)
self.canvas = ipympl.backend_nbagg.Canvas(self.fig)
self.manager = ipympl.backend_nbagg.FigureManager(self.canvas, 0)


class _IpyMplCanvas(_AbstractMplCanvas, _IpyMplInterface):
Expand Down

0 comments on commit 33d5db7

Please sign in to comment.