##// END OF EJS Templates
fix circular matplotlib imports on ipykernel 4.4 + python 2...
Min RK -
Show More
@@ -199,7 +199,6 b' def select_figure_formats(shell, formats, **kwargs):'
199 """
199 """
200 import matplotlib
200 import matplotlib
201 from matplotlib.figure import Figure
201 from matplotlib.figure import Figure
202 from ipykernel.pylab import backend_inline
203
202
204 svg_formatter = shell.display_formatter.formatters['image/svg+xml']
203 svg_formatter = shell.display_formatter.formatters['image/svg+xml']
205 png_formatter = shell.display_formatter.formatters['image/png']
204 png_formatter = shell.display_formatter.formatters['image/png']
@@ -358,7 +357,7 b' def configure_inline_support(shell, backend):'
358 from ipykernel.pylab.backend_inline import InlineBackend
357 from ipykernel.pylab.backend_inline import InlineBackend
359 except ImportError:
358 except ImportError:
360 return
359 return
361 from matplotlib import pyplot
360 import matplotlib
362
361
363 cfg = InlineBackend.instance(parent=shell)
362 cfg = InlineBackend.instance(parent=shell)
364 cfg.shell = shell
363 cfg.shell = shell
@@ -372,9 +371,9 b' def configure_inline_support(shell, backend):'
372 # Save rcParams that will be overwrittern
371 # Save rcParams that will be overwrittern
373 shell._saved_rcParams = dict()
372 shell._saved_rcParams = dict()
374 for k in cfg.rc:
373 for k in cfg.rc:
375 shell._saved_rcParams[k] = pyplot.rcParams[k]
374 shell._saved_rcParams[k] = matplotlib.rcParams[k]
376 # load inline_rc
375 # load inline_rc
377 pyplot.rcParams.update(cfg.rc)
376 matplotlib.rcParams.update(cfg.rc)
378 new_backend_name = "inline"
377 new_backend_name = "inline"
379 else:
378 else:
380 from ipykernel.pylab.backend_inline import flush_figures
379 from ipykernel.pylab.backend_inline import flush_figures
@@ -383,7 +382,7 b' def configure_inline_support(shell, backend):'
383 except ValueError:
382 except ValueError:
384 pass
383 pass
385 if hasattr(shell, '_saved_rcParams'):
384 if hasattr(shell, '_saved_rcParams'):
386 pyplot.rcParams.update(shell._saved_rcParams)
385 matplotlib.rcParams.update(shell._saved_rcParams)
387 del shell._saved_rcParams
386 del shell._saved_rcParams
388 new_backend_name = "other"
387 new_backend_name = "other"
389
388
General Comments 0
You need to be logged in to leave comments. Login now