當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。