postprocessing.matplotlib
Submodules
Functions
Function to get a list of the names of the available styles. |
|
|
Function to get the stylesheet that can be passed to matplotlib's style |
|
Function to get colors associated with a matplotlib style, using either the |
|
Function to shift the axes/spines. |
|
Function to save figures in multiple file formats with user specied |
Package Contents
- postprocessing.matplotlib.get_available_styles()
Function to get a list of the names of the available styles.
- Returns:
- list
List of names of available styles.
- postprocessing.matplotlib.get_style(style_name='doumont-light')
Function to get the stylesheet that can be passed to matplotlib’s style setting functions.
- Parameters:
- style_namestr
Name of desired style. Default is “doumont-light”.
- Returns:
- str
The style string that can be passed to the matplotlib style setting function.
- postprocessing.matplotlib.get_colors(style_name=None, rcParams=False)
Function to get colors associated with a matplotlib style, using either the current style or a specified style.
This function does not work for built-in matplotlib styles.
- Parameters:
- style_namestr
Name of the desired style. Default is None, which returns the colors from the current style.
- rcParamsbool
Flag to return the colors associated with rcParams. Default is False.
- Returns:
- dict
Dictionary of colors used in the style.
- postprocessing.matplotlib.adjust_spines(ax=None, spines=['left', 'bottom'], outward=True)
Function to shift the axes/spines.
- Parameters:
- axMatplotlib axes
Figure axes to adjust. Default is None, which will pickup the current axes.
- spineslist
List of strings defining which spines to adjust. Default is left and bottom.
- outwardbool
Flag to shift spines outward. Default is False.
- postprocessing.matplotlib.save_figs(fig, name, formats, format_kwargs=None, **kwargs)
Function to save figures in multiple file formats with user specied options.
- Parameters:
- figMatplotlib figure
The figure to save.
- namestr
Output path for the figure files, e.g “path/to/file/file_name”. No file extension required.
- formatsstr or list
File formats to save the figure in, e.g. “png”, “pdf”, “svg”.
- format_kwargsdict
A dictionary of dictionaries, where the keys are the file formats and the values are any keyword arguments that should only be applied to that format. These kwargs will be added to ones passed to all formats, by default None
- kwargs
Any keyword arguments to pass to plt.savefig() for all formats.