Python matplotlib.rcParamsDefault() Examples
The following are 18
code examples of matplotlib.rcParamsDefault().
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
, or try the search function
.
Example #1
Source File: agu_plot.py From hydrology with GNU General Public License v3.0 | 6 votes |
def format_axes(ax): for spine in ['top', 'right']: ax.spines[spine].set_visible(False) for spine in ['left', 'bottom']: ax.spines[spine].set_color(SPINE_COLOR) ax.spines[spine].set_linewidth(0.5) ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') for axis in [ax.xaxis, ax.yaxis]: axis.set_tick_params(direction='out', color=SPINE_COLOR) return ax # mpl.rcParams.update(mpl.rcParamsDefault)
Example #2
Source File: animation.py From twitter-stock-recommendation with MIT License | 6 votes |
def _init_from_registry(cls): if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert': return from six.moves import winreg for flag in (0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY): try: hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, 'Software\\Imagemagick\\Current', 0, winreg.KEY_QUERY_VALUE | flag) binpath = winreg.QueryValueEx(hkey, 'BinPath')[0] winreg.CloseKey(hkey) binpath += '\\convert.exe' break except Exception: binpath = '' rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
Example #3
Source File: animation.py From coffeegrindsize with MIT License | 6 votes |
def _init_from_registry(cls): if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert': return import winreg for flag in (0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY): try: hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Imagemagick\Current', 0, winreg.KEY_QUERY_VALUE | flag) binpath = winreg.QueryValueEx(hkey, 'BinPath')[0] winreg.CloseKey(hkey) break except Exception: binpath = '' if binpath: for exe in ('convert.exe', 'magick.exe'): path = os.path.join(binpath, exe) if os.path.exists(path): binpath = path break else: binpath = '' rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
Example #4
Source File: animation.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _init_from_registry(cls): if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert': return import winreg for flag in (0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY): try: hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Imagemagick\Current', 0, winreg.KEY_QUERY_VALUE | flag) binpath = winreg.QueryValueEx(hkey, 'BinPath')[0] winreg.CloseKey(hkey) break except Exception: binpath = '' if binpath: for exe in ('convert.exe', 'magick.exe'): path = os.path.join(binpath, exe) if os.path.exists(path): binpath = path break else: binpath = '' rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
Example #5
Source File: animation.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _init_from_registry(cls): if sys.platform != 'win32' or rcParams[cls.exec_key] != 'convert': return import winreg for flag in (0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY): try: hkey = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'Software\Imagemagick\Current', 0, winreg.KEY_QUERY_VALUE | flag) binpath = winreg.QueryValueEx(hkey, 'BinPath')[0] winreg.CloseKey(hkey) break except Exception: binpath = '' if binpath: for exe in ('convert.exe', 'magick.exe'): path = os.path.join(binpath, exe) if os.path.exists(path): binpath = path break else: binpath = '' rcParams[cls.exec_key] = rcParamsDefault[cls.exec_key] = binpath
Example #6
Source File: rcmod.py From nelpy with MIT License | 5 votes |
def reset_defaults(): """Restore all RC params to default settings.""" mpl.rcParams.update(mpl.rcParamsDefault)
Example #7
Source File: settings.py From scvelo with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_rcParams_defaults(): """Reset `matplotlib.rcParams` to defaults.""" from matplotlib import rcParamsDefault rcParams.update(rcParamsDefault) # ------------------------------------------------------------------------------ # Private global variables & functions # ------------------------------------------------------------------------------
Example #8
Source File: configuration.py From dynamo-release with BSD 3-Clause "New" or "Revised" License | 5 votes |
def reset_rcParams(): """Reset `matplotlib.rcParams` to defaults.""" from matplotlib import rcParamsDefault rcParams.update(rcParamsDefault)
Example #9
Source File: _rcmod.py From scanpy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_rcParams_defaults(): """Reset `matplotlib.rcParams` to defaults.""" rcParams.update(matplotlib.rcParamsDefault)
Example #10
Source File: pyplot.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def switch_backend(newbackend): """ Close all open figures and set the Matplotlib backend. The argument is case-insensitive. Switching to an interactive backend is possible only if no event loop for another interactive backend has started. Switching to and from non-interactive backends is always possible. Parameters ---------- newbackend : str The name of the backend to use. """ close("all") if newbackend is rcsetup._auto_backend_sentinel: for candidate in ["macosx", "qt5agg", "qt4agg", "gtk3agg", "gtk3cairo", "tkagg", "wxagg", "agg", "cairo"]: try: switch_backend(candidate) except ImportError: continue else: rcParamsOrig['backend'] = candidate return backend_name = ( newbackend[9:] if newbackend.startswith("module://") else "matplotlib.backends.backend_{}".format(newbackend.lower())) backend_mod = importlib.import_module(backend_name) Backend = type( "Backend", (matplotlib.backends._Backend,), vars(backend_mod)) _log.debug("Loaded backend %s version %s.", newbackend, Backend.backend_version) required_framework = Backend.required_interactive_framework current_framework = \ matplotlib.backends._get_running_interactive_framework() if (current_framework and required_framework and current_framework != required_framework): raise ImportError( "Cannot load backend {!r} which requires the {!r} interactive " "framework, as {!r} is currently running".format( newbackend, required_framework, current_framework)) rcParams['backend'] = rcParamsDefault['backend'] = newbackend global _backend_mod, new_figure_manager, draw_if_interactive, _show _backend_mod = backend_mod new_figure_manager = Backend.new_figure_manager draw_if_interactive = Backend.draw_if_interactive _show = Backend.show # Need to keep a global reference to the backend for compatibility reasons. # See https://github.com/matplotlib/matplotlib/issues/6092 matplotlib.backends.backend = newbackend
Example #11
Source File: core.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, str) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, str) else s for s in styles) for style in styles: if not isinstance(style, str): _apply_style(style) elif style == 'default': # Deprecation warnings were already handled when creating # rcParamsDefault, no need to reemit them here. with warnings.catch_warnings(): warnings.simplefilter("ignore", MatplotlibDeprecationWarning) _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))
Example #12
Source File: core.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, str) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, str) else s for s in styles) for style in styles: if not isinstance(style, str): _apply_style(style) elif style == 'default': # Deprecation warnings were already handled when creating # rcParamsDefault, no need to reemit them here. with warnings.catch_warnings(): warnings.simplefilter("ignore", MatplotlibDeprecationWarning) _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))
Example #13
Source File: pyplot.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def switch_backend(newbackend): """ Close all open figures and set the Matplotlib backend. The argument is case-insensitive. Switching to an interactive backend is possible only if no event loop for another interactive backend has started. Switching to and from non-interactive backends is always possible. Parameters ---------- newbackend : str The name of the backend to use. """ close("all") if newbackend is rcsetup._auto_backend_sentinel: for candidate in ["macosx", "qt5agg", "qt4agg", "gtk3agg", "gtk3cairo", "tkagg", "wxagg", "agg", "cairo"]: try: switch_backend(candidate) except ImportError: continue else: rcParamsOrig['backend'] = candidate return backend_name = ( newbackend[9:] if newbackend.startswith("module://") else "matplotlib.backends.backend_{}".format(newbackend.lower())) backend_mod = importlib.import_module(backend_name) Backend = type( "Backend", (matplotlib.backends._Backend,), vars(backend_mod)) _log.debug("Loaded backend %s version %s.", newbackend, Backend.backend_version) required_framework = Backend.required_interactive_framework if required_framework is not None: current_framework = \ matplotlib.backends._get_running_interactive_framework() if (current_framework and required_framework and current_framework != required_framework): raise ImportError( "Cannot load backend {!r} which requires the {!r} interactive " "framework, as {!r} is currently running".format( newbackend, required_framework, current_framework)) rcParams['backend'] = rcParamsDefault['backend'] = newbackend global _backend_mod, new_figure_manager, draw_if_interactive, _show _backend_mod = backend_mod new_figure_manager = Backend.new_figure_manager draw_if_interactive = Backend.draw_if_interactive _show = Backend.show # Need to keep a global reference to the backend for compatibility reasons. # See https://github.com/matplotlib/matplotlib/issues/6092 matplotlib.backends.backend = newbackend
Example #14
Source File: core.py From coffeegrindsize with MIT License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, str) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, str) else s for s in styles) for style in styles: if not isinstance(style, str): _apply_style(style) elif style == 'default': # Deprecation warnings were already handled when creating # rcParamsDefault, no need to reemit them here. with warnings.catch_warnings(): warnings.simplefilter("ignore", MatplotlibDeprecationWarning) _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))
Example #15
Source File: pyplot.py From coffeegrindsize with MIT License | 4 votes |
def switch_backend(newbackend): """ Close all open figures and set the Matplotlib backend. The argument is case-insensitive. Switching to an interactive backend is possible only if no event loop for another interactive backend has started. Switching to and from non-interactive backends is always possible. Parameters ---------- newbackend : str The name of the backend to use. """ close("all") if newbackend is rcsetup._auto_backend_sentinel: for candidate in ["macosx", "qt5agg", "qt4agg", "gtk3agg", "gtk3cairo", "tkagg", "wxagg", "agg", "cairo"]: try: switch_backend(candidate) except ImportError: continue else: rcParamsOrig['backend'] = candidate return backend_name = ( newbackend[9:] if newbackend.startswith("module://") else "matplotlib.backends.backend_{}".format(newbackend.lower())) backend_mod = importlib.import_module(backend_name) Backend = type( "Backend", (matplotlib.backends._Backend,), vars(backend_mod)) _log.debug("Loaded backend %s version %s.", newbackend, Backend.backend_version) required_framework = Backend.required_interactive_framework if required_framework is not None: current_framework = \ matplotlib.backends._get_running_interactive_framework() if (current_framework and required_framework and current_framework != required_framework): raise ImportError( "Cannot load backend {!r} which requires the {!r} interactive " "framework, as {!r} is currently running".format( newbackend, required_framework, current_framework)) rcParams['backend'] = rcParamsDefault['backend'] = newbackend global _backend_mod, new_figure_manager, draw_if_interactive, _show _backend_mod = backend_mod new_figure_manager = Backend.new_figure_manager draw_if_interactive = Backend.draw_if_interactive _show = Backend.show # Need to keep a global reference to the backend for compatibility reasons. # See https://github.com/matplotlib/matplotlib/issues/6092 matplotlib.backends.backend = newbackend
Example #16
Source File: core.py From CogAlg with MIT License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, str) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, str) else s for s in styles) for style in styles: if not isinstance(style, str): _apply_style(style) elif style == 'default': # Deprecation warnings were already handled when creating # rcParamsDefault, no need to reemit them here. with cbook._suppress_matplotlib_deprecation_warning(): _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))
Example #17
Source File: core.py From twitter-stock-recommendation with MIT License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, six.string_types) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, six.string_types) else s for s in styles) for style in styles: if not isinstance(style, six.string_types): _apply_style(style) elif style == 'default': _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))
Example #18
Source File: core.py From Mastering-Elasticsearch-7.0 with MIT License | 4 votes |
def use(style): """Use matplotlib style settings from a style specification. The style name of 'default' is reserved for reverting back to the default style settings. Parameters ---------- style : str, dict, or list A style specification. Valid options are: +------+-------------------------------------------------------------+ | str | The name of a style or a path/URL to a style file. For a | | | list of available style names, see `style.available`. | +------+-------------------------------------------------------------+ | dict | Dictionary with valid key/value pairs for | | | `matplotlib.rcParams`. | +------+-------------------------------------------------------------+ | list | A list of style specifiers (str or dict) applied from first | | | to last in the list. | +------+-------------------------------------------------------------+ """ style_alias = {'mpl20': 'default', 'mpl15': 'classic'} if isinstance(style, str) or hasattr(style, 'keys'): # If name is a single str or dict, make it a single element list. styles = [style] else: styles = style styles = (style_alias.get(s, s) if isinstance(s, str) else s for s in styles) for style in styles: if not isinstance(style, str): _apply_style(style) elif style == 'default': # Deprecation warnings were already handled when creating # rcParamsDefault, no need to reemit them here. with cbook._suppress_matplotlib_deprecation_warning(): _apply_style(rcParamsDefault, warn=False) elif style in library: _apply_style(library[style]) else: try: rc = rc_params_from_file(style, use_default_template=False) _apply_style(rc) except IOError: raise IOError( "{!r} not found in the style library and input is not a " "valid URL or path; see `style.available` for list of " "available styles".format(style))