scaffold.plotting
Attributes
Classes
Plotting style options. |
Functions
|
Add a small logo to the corner of a matplotlib figure. |
|
Get color cycle for the chosen style. |
|
Get Matplotlib context manager for the chosen style. |
|
Get rc (runtime configuration) parameters for the chosen style. |
Module Contents
- class scaffold.plotting.MXM_STYLE(*args, **kwds)
Bases:
enum.EnumPlotting style options.
- DARK = 2
- LIGHT = 1
- scaffold.plotting.add_logo(fig: matplotlib.pyplot.Figure, style: MXM_STYLE = MXM_STYLE.LIGHT, variant: int = 0, logo_path: str | pathlib.Path | None = None, position: str = 'upper right', size: float = 0.08, alpha: float = 0.8) None
Add a small logo to the corner of a matplotlib figure.
- Parameters:
fig – The matplotlib figure to add the logo to.
style – The style, used to pick an appropriate default logo. Defaults to MXM_STYLE.LIGHT.
variant – The variant of the style. Used to select a contrasting logo. Defaults to 0.
logo_path – Path or URI to a custom logo image. If None, uses the default logo for the style/variant.
position – Corner placement. One of “lower right”, “lower left”, “upper right”, “upper left”.
size – Size of the logo as a fraction of figure height. Defaults to 0.08.
alpha – Opacity of the logo. Defaults to 0.8.
- scaffold.plotting.get_color_cycle(style: MXM_STYLE = MXM_STYLE.LIGHT) List[str]
Get color cycle for the chosen style.
- Parameters:
style (MXM_STYLE, optional) – The style used for plotting. Defaults to MXM_STYLE.LIGHT.
- Returns:
List of colors for the color cycle.
- Return type:
List[str]
- scaffold.plotting.get_mpl_context(style: MXM_STYLE = MXM_STYLE.LIGHT, variant: int = 0) contextlib.AbstractContextManager[None]
Get Matplotlib context manager for the chosen style.
- Parameters:
style (MXM_STYLE, optional) – The style used for plotting. Defaults to MXM_STYLE.LIGHT.
variant (int, optional) – The variant of the style to use. Defaults to 0.
- Returns:
Context manager for Matplotlib.
- Return type:
AbstractContextManager[None]
- scaffold.plotting.get_rc_params(style: MXM_STYLE = MXM_STYLE.LIGHT, variant: int = 0) dict
Get rc (runtime configuration) parameters for the chosen style. Used for customizing the properties and default styles of Matplotlib.
Some fonts are not available by default in Matplotlib, so you may need to install them, see Plotting.
- Parameters:
style (MXM_STYLE, optional) – The style used for plotting. Defaults to MXM_STYLE.LIGHT.
variant (int, optional) – The variant of the style to use. Defaults to 0.
- Returns:
Dictionary with rc parameters.
- Return type:
dict
- scaffold.plotting.ADMIRAL = '#1D0693'
- scaffold.plotting.ASSETS_DIR
- scaffold.plotting.BLACK = '#000000'
- scaffold.plotting.BLUEBERRY = '#381D59'
- scaffold.plotting.CARIBBEAN = '#11D8C1'
- scaffold.plotting.CORAL = '#FF5665'
- scaffold.plotting.ELECTRIC = '#9E36FF'
- scaffold.plotting.LAVENDER = '#ABABF9'
- scaffold.plotting.LOGO_MAP
- scaffold.plotting.MXM_THEME
- scaffold.plotting.OFFWHITE = '#FFFAF4'
- scaffold.plotting.PINE = '#007D85'
- scaffold.plotting.TITLE_FONT
- scaffold.plotting.VANILLA = '#FFFFAE'
- scaffold.plotting.VERMILLION = '#CE3D4A'
- scaffold.plotting.WHITE = '#FFFFFF'