Python matplotlib.backend_bases.FigureManagerBase() Examples
The following are 16
code examples of matplotlib.backend_bases.FigureManagerBase().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.backend_bases
, or try the search function
.
Example #1
Source File: backend_webagg.py From Computable with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #2
Source File: backend_webagg_core.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #3
Source File: backend_webagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #4
Source File: backend_webagg_core.py From neural-network-animation with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #5
Source File: backend_webagg_core.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #6
Source File: backend_webagg_core.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #7
Source File: backend_webagg_core.py From ImageFusion with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #8
Source File: wasm_backend.py From pyodide with Mozilla Public License 2.0 | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.set_window_title("Figure %d" % num) self.toolbar = NavigationToolbar2Wasm(canvas)
Example #9
Source File: backend_webagg_core.py From coffeegrindsize with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #10
Source File: backend_webagg_core.py From CogAlg with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #11
Source File: backend_webagg_core.py From twitter-stock-recommendation with MIT License | 5 votes |
def __init__(self, canvas, num): backend_bases.FigureManagerBase.__init__(self, canvas, num) self.web_sockets = set() self.toolbar = self._get_toolbar(canvas)
Example #12
Source File: plot_directive.py From Mastering-Elasticsearch-7.0 with MIT License | 4 votes |
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
Example #13
Source File: plot_directive.py From GraphicDesignPatternByPython with MIT License | 4 votes |
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
Example #14
Source File: plot_directive.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #15
Source File: plot_directive.py From coffeegrindsize with MIT License | 4 votes |
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
Example #16
Source File: plot_directive.py From CogAlg with MIT License | 4 votes |
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