Beispiel #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, 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)
Beispiel #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)
Beispiel #3
0
 def configure_once(*args):
     activate_matplotlib(backend)
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)
Beispiel #4
0
def get_convis_attribute(o, k, default=None):
    return getattr(o, k, default)


plotting_possible = False
plotting_exceptions = []
do_3d_plot = True
try:
    import matplotlib
    from matplotlib import cm
    import matplotlib.pylab as plt
    from IPython.core import pylabtools as pt
    gui, backend = pt.find_gui_and_backend('inline', 'inline')
    from IPython.core.pylabtools import activate_matplotlib
    activate_matplotlib(backend)
    plotting_possible = True
except Exception as e:
    plotting_exceptions.append(e)
    pass

doc_urls = [
    ('convis.filters.retina',
     'https://jahuth.github.io/convis/docs_retina.html#'),
    ('convis.filters.spiking',
     'https://jahuth.github.io/convis/filters.html#'),
    ('convis.filters', 'https://jahuth.github.io/convis/docs_filters.html#'),
    ('convis.models', 'https://jahuth.github.io/convis/docs_models.html#'),
    ('convis.retina', 'https://jahuth.github.io/convis/docs_retina.html#'),
    ('convis.base', 'https://jahuth.github.io/convis/docs.html#'),
    ('convis.streams', 'https://jahuth.github.io/convis/docs_streams.html#'),
 def configure_once(*args):
     activate_matplotlib(backend)
     configure_inline_support(ip, backend)
     ip.events.unregister('post_run_cell', configure_once)