On this page Signature

mespy.plot_utils

_resolve_style

Signature

_resolve_style(style: str | None) -> str | None

What problem it solves

Converts a short style name included in mespy/stylelib to the absolute path of the related .mplstyle file.

This allows histogram to accept style="mespy", style="report" or style="column" without asking the user for the path to the style file.

Input contract

  • If mespy/stylelib/{style}.mplstyle exists, returns the path of the file.

  • If the style does not match a file included in the package, returns the received value.

  • style=None remains None, so _style_context can leave the current rcParams unchanged.

Where it is used

  • in histogram, before entering _style_context

lin_fit does not use it: it passes the style directly to _style_context. Short names still work, because import mespy registers the bundled styles in Matplotlib’s style library.

How it fails

The resolution is intentionally permissive: if the lookup into the package resources fails, the function returns the original style. Any error is then left to Matplotlib when _style_context tries to apply that style.

Because it remains private

It is an infrastructure helper for the style system. Documenting it clarifies why bundled styles work with short names, but it is not intended as a standalone public API.