We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 89e53aa + 8b7382d commit 84f0460Copy full SHA for 84f0460
lib/matplotlib/figure.py
@@ -344,8 +344,12 @@ def __init__(self,
344
# use it, for some reason.
345
346
def _repr_html_(self):
347
- from matplotlib.backends import backend_webagg
348
- return backend_webagg.ipython_inline_display(self)
+ # We can't use "isinstance" here, because then we'd end up importing
+ # 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)
353
354
def show(self, warn=True):
355
"""
0 commit comments