We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ad86c8 commit 0d37358Copy full SHA for 0d37358
lib/matplotlib/pyplot.py
@@ -263,7 +263,6 @@ def switch_backend(newbackend):
263
264
backend_mod = importlib.import_module(
265
cbook._backend_module_name(newbackend))
266
- canvas_class = backend_mod.FigureCanvas
267
268
required_framework = _get_required_interactive_framework(backend_mod)
269
if required_framework is not None:
@@ -293,6 +292,8 @@ class backend_mod(matplotlib.backend_bases._Backend):
293
292
# also update backend_mod accordingly; also, per-backend customization of
294
# draw_if_interactive is disabled.
295
if new_figure_manager is None:
+ # only try to get the canvas class if have opted into the new scheme
296
+ canvas_class = backend_mod.FigureCanvas
297
def new_figure_manager_given_figure(num, figure):
298
return canvas_class.new_manager(figure, num)
299
0 commit comments