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


Python backend_bases.FigureManagerBase方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib import backend_bases [as 别名]
# 或者: from matplotlib.backend_bases import FigureManagerBase [as 别名]
def __init__(self, canvas, num):
        backend_bases.FigureManagerBase.__init__(self, canvas, num)

        self.web_sockets = set()

        self.toolbar = self._get_toolbar(canvas) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:backend_webagg.py

示例2: __init__

# 需要导入模块: from matplotlib import backend_bases [as 别名]
# 或者: from matplotlib.backend_bases import FigureManagerBase [as 别名]
def __init__(self, canvas, num):
        backend_bases.FigureManagerBase.__init__(self, canvas, num)
        self.set_window_title("Figure %d" % num)
        self.toolbar = NavigationToolbar2Wasm(canvas) 
开发者ID:iodide-project,项目名称:pyodide,代码行数:6,代码来源:wasm_backend.py

示例3: run_code

# 需要导入模块: from matplotlib import backend_bases [as 别名]
# 或者: from matplotlib.backend_bases import FigureManagerBase [as 别名]
def run_code(code, code_path, ns=None, function_name=None):
    """
    Import a Python module from a path, and run the function given by
    name, if function_name is not None.
    """

    # Change the working directory to the directory of the example, so
    # it can get at its data files, if any.  Add its path to sys.path
    # so it can import any helper modules sitting beside it.
    pwd = os.getcwd()
    if setup.config.plot_working_directory is not None:
        try:
            os.chdir(setup.config.plot_working_directory)
        except OSError as err:
            raise OSError(str(err) + '\n`plot_working_directory` option in'
                          'Sphinx configuration file must be a valid '
                          'directory path')
        except TypeError as err:
            raise TypeError(str(err) + '\n`plot_working_directory` option in '
                            'Sphinx configuration file must be a string or '
                            'None')
    elif code_path is not None:
        dirname = os.path.abspath(os.path.dirname(code_path))
        os.chdir(dirname)

    with cbook._setattr_cm(
            sys, argv=[code_path], path=[os.getcwd(), *sys.path]), \
            contextlib.redirect_stdout(StringIO()):
        try:
            code = unescape_doctest(code)
            if ns is None:
                ns = {}
            if not ns:
                if setup.config.plot_pre_code is None:
                    exec('import numpy as np\n'
                         'from matplotlib import pyplot as plt\n', ns)
                else:
                    exec(str(setup.config.plot_pre_code), ns)
            if "__main__" in code:
                ns['__name__'] = '__main__'

            # Patch out non-interactive show() to avoid triggering a warning.
            with cbook._setattr_cm(FigureManagerBase, show=lambda self: None):
                exec(code, ns)
                if function_name is not None:
                    exec(function_name + "()", ns)

        except (Exception, SystemExit) as err:
            raise PlotError(traceback.format_exc())
        finally:
            os.chdir(pwd)
    return ns 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:54,代码来源:plot_directive.py


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