當前位置: 首頁>>代碼示例>>Python>>正文


Python InlineBackend.instance方法代碼示例

本文整理匯總了Python中ipykernel.pylab.config.InlineBackend.instance方法的典型用法代碼示例。如果您正苦於以下問題:Python InlineBackend.instance方法的具體用法?Python InlineBackend.instance怎麽用?Python InlineBackend.instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ipykernel.pylab.config.InlineBackend的用法示例。


在下文中一共展示了InlineBackend.instance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: set_matplotlib_formats

# 需要導入模塊: from ipykernel.pylab.config import InlineBackend [as 別名]
# 或者: from ipykernel.pylab.config.InlineBackend import instance [as 別名]
def set_matplotlib_formats(*formats, **kwargs):
    """Select figure formats for the inline backend. Optionally pass quality for JPEG.

    For example, this enables PNG and JPEG output with a JPEG quality of 90%::

        In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)

    To set this in your config files use the following::
    
        c.InlineBackend.figure_formats = {'png', 'jpeg'}
        c.InlineBackend.print_figure_kwargs.update({'quality' : 90})

    Parameters
    ----------
    *formats : strs
        One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'.
    **kwargs :
        Keyword args will be relayed to ``figure.canvas.print_figure``.
    """
    from IPython.core.interactiveshell import InteractiveShell
    from IPython.core.pylabtools import select_figure_formats
    # build kwargs, starting with InlineBackend config
    kw = {}
    from ipykernel.pylab.config import InlineBackend
    cfg = InlineBackend.instance()
    kw.update(cfg.print_figure_kwargs)
    kw.update(**kwargs)
    shell = InteractiveShell.instance()
    select_figure_formats(shell, formats, **kw)
開發者ID:marcosptf,項目名稱:fedora,代碼行數:31,代碼來源:display.py

示例2: set_matplotlib_close

# 需要導入模塊: from ipykernel.pylab.config import InlineBackend [as 別名]
# 或者: from ipykernel.pylab.config.InlineBackend import instance [as 別名]
def set_matplotlib_close(close=True):
    """Set whether the inline backend closes all figures automatically or not.
    
    By default, the inline backend used in the IPython Notebook will close all
    matplotlib figures automatically after each cell is run. This means that
    plots in different cells won't interfere. Sometimes, you may want to make
    a plot in one cell and then refine it in later cells. This can be accomplished
    by::
    
        In [1]: set_matplotlib_close(False)
    
    To set this in your config files use the following::
    
        c.InlineBackend.close_figures = False
    
    Parameters
    ----------
    close : bool
        Should all matplotlib figures be automatically closed after each cell is
        run?
    """
    from ipykernel.pylab.config import InlineBackend
    cfg = InlineBackend.instance()
    cfg.close_figures = close
開發者ID:marcosptf,項目名稱:fedora,代碼行數:26,代碼來源:display.py

示例3: _get_inline_config

# 需要導入模塊: from ipykernel.pylab.config import InlineBackend [as 別名]
# 或者: from ipykernel.pylab.config.InlineBackend import instance [as 別名]
def _get_inline_config():
    from ipykernel.pylab.config import InlineBackend
    return InlineBackend.instance()
開發者ID:mmadhavan,項目名稱:CtCI-6th-Edition,代碼行數:5,代碼來源:test_display.py


注:本文中的ipykernel.pylab.config.InlineBackend.instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。