当前位置: 首页>>代码示例>>Python>>正文


Python backend_bases._Backend方法代码示例

本文整理汇总了Python中matplotlib.backend_bases._Backend方法的典型用法代码示例。如果您正苦于以下问题:Python backend_bases._Backend方法的具体用法?Python backend_bases._Backend怎么用?Python backend_bases._Backend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backend_bases的用法示例。


在下文中一共展示了backend_bases._Backend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pylab_setup

# 需要导入模块: from matplotlib import backend_bases [as 别名]
# 或者: from matplotlib.backend_bases import _Backend [as 别名]
def pylab_setup(name=None):
    """
    Return new_figure_manager, draw_if_interactive and show for pyplot.

    This provides the backend-specific functions that are used by pyplot to
    abstract away the difference between backends.

    Parameters
    ----------
    name : str, optional
        The name of the backend to use.  If `None`, falls back to
        ``matplotlib.get_backend()`` (which return :rc:`backend`).

    Returns
    -------
    backend_mod : module
        The module which contains the backend of choice

    new_figure_manager : function
        Create a new figure manager (roughly maps to GUI window)

    draw_if_interactive : function
        Redraw the current figure if pyplot is interactive

    show : function
        Show (and possibly block) any unshown figures.
    """
    # Import the requested backend into a generic module object.
    if name is None:
        name = matplotlib.get_backend()
    backend_name = (name[9:] if name.startswith("module://")
                    else "matplotlib.backends.backend_{}".format(name.lower()))
    backend_mod = importlib.import_module(backend_name)
    # Create a local Backend class whose body corresponds to the contents of
    # the backend module.  This allows the Backend class to fill in the missing
    # methods through inheritance.
    Backend = type("Backend", (_Backend,), vars(backend_mod))

    # Need to keep a global reference to the backend for compatibility reasons.
    # See https://github.com/matplotlib/matplotlib/issues/6092
    global backend
    backend = name

    _log.debug('backend %s version %s', name, Backend.backend_version)
    return (backend_mod,
            Backend.new_figure_manager,
            Backend.draw_if_interactive,
            Backend.show) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:50,代码来源:__init__.py


注:本文中的matplotlib.backend_bases._Backend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。