Show More
@@ -269,6 +269,7 b' def configure_inline_support(shell, backend, user_ns=None):' | |||||
269 | from IPython.zmq.pylab.backend_inline import InlineBackend |
|
269 | from IPython.zmq.pylab.backend_inline import InlineBackend | |
270 | except ImportError: |
|
270 | except ImportError: | |
271 | return |
|
271 | return | |
|
272 | from matplotlib import pyplot | |||
272 |
|
273 | |||
273 | user_ns = shell.user_ns if user_ns is None else user_ns |
|
274 | user_ns = shell.user_ns if user_ns is None else user_ns | |
274 |
|
275 | |||
@@ -279,12 +280,23 b' def configure_inline_support(shell, backend, user_ns=None):' | |||||
279 |
|
280 | |||
280 | if backend == backends['inline']: |
|
281 | if backend == backends['inline']: | |
281 | from IPython.zmq.pylab.backend_inline import flush_figures |
|
282 | from IPython.zmq.pylab.backend_inline import flush_figures | |
282 | from matplotlib import pyplot |
|
|||
283 | shell.register_post_execute(flush_figures) |
|
283 | shell.register_post_execute(flush_figures) | |
|
284 | ||||
|
285 | # Save rcParams that will be overwrittern | |||
|
286 | shell._saved_rcParams = dict() | |||
|
287 | for k in cfg.rc: | |||
|
288 | shell._saved_rcParams[k] = pyplot.rcParams[k] | |||
284 | # load inline_rc |
|
289 | # load inline_rc | |
285 | pyplot.rcParams.update(cfg.rc) |
|
290 | pyplot.rcParams.update(cfg.rc) | |
286 | # Add 'figsize' to pyplot and to the user's namespace |
|
291 | # Add 'figsize' to pyplot and to the user's namespace | |
287 | user_ns['figsize'] = pyplot.figsize = figsize |
|
292 | user_ns['figsize'] = pyplot.figsize = figsize | |
|
293 | else: | |||
|
294 | from IPython.zmq.pylab.backend_inline import flush_figures | |||
|
295 | if flush_figures in shell._post_execute: | |||
|
296 | shell._post_execute.pop(flush_figures) | |||
|
297 | if hasattr(shell, '_saved_rcParams'): | |||
|
298 | pyplot.rcParams.update(shell._saved_rcParams) | |||
|
299 | del shell._saved_rcParams | |||
288 |
|
300 | |||
289 | # Setup the default figure format |
|
301 | # Setup the default figure format | |
290 | fmt = cfg.figure_format |
|
302 | fmt = cfg.figure_format |
General Comments 0
You need to be logged in to leave comments.
Login now