Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b7382d

Browse files
committed
Make pylab inline figures work again
1 parent 89e53aa commit 8b7382d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/figure.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,12 @@ def __init__(self,
344344
# use it, for some reason.
345345

346346
def _repr_html_(self):
347-
from matplotlib.backends import backend_webagg
348-
return backend_webagg.ipython_inline_display(self)
347+
# We can't use "isinstance" here, because then we'd end up importing
348+
# webagg unconditiionally.
349+
if (self.canvas is not None and
350+
'WebAgg' in self.canvas.__class__.__name__):
351+
from matplotlib.backends import backend_webagg
352+
return backend_webagg.ipython_inline_display(self)
349353

350354
def show(self, warn=True):
351355
"""

0 commit comments

Comments
 (0)