Пример #1
0
def _enable_matplotlib_integration():
    """Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend."""
    from matplotlib import get_backend
    ip = get_ipython()
    backend = get_backend()
    if ip and backend == 'module://%s' % __name__:
        from IPython.core.pylabtools import configure_inline_support
        try:
            configure_inline_support(ip, backend)
        except ImportError:
            # bugs may cause a circular import on Python 2
            def configure_once(*args):
                configure_inline_support(ip, backend)
                ip.events.unregister('post_run_cell', configure_once)
            ip.events.register('post_run_cell', configure_once)
Пример #2
0
def _enable_matplotlib_integration():
    """Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend."""
    from matplotlib import get_backend
    ip = get_ipython()
    backend = get_backend()
    if ip and backend == 'module://%s' % __name__:
        from IPython.core.pylabtools import configure_inline_support, activate_matplotlib
        try:
            activate_matplotlib(backend)
            configure_inline_support(ip, backend)
        except (ImportError, AttributeError):
            # bugs may cause a circular import on Python 2
            def configure_once(*args):
                activate_matplotlib(backend)
                configure_inline_support(ip, backend)
                ip.events.unregister('post_run_cell', configure_once)
            ip.events.register('post_run_cell', configure_once)
Пример #3
0
 def configure_once(*args):
     activate_matplotlib(backend)
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)
Пример #4
0
 def configure_once(*args):
     activate_matplotlib(backend)
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)
Пример #5
0
 def configure_once(*args):
     matplotlib.interactive(True)
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)
Пример #6
0
 def configure_once(*args):
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)