_style module¶
Plotting utilities for CLI scripts (no import-time side effects).
- pyrockfall.scripts._style.configure_matplotlib(use_latex: bool = True, figure_dpi: int = 600, figure_width_in: float | None = 3.0, figure_height_in: float | None = 3.0, serif_family: str = 'serif', latex_preamble: str = '\\usepackage{newtxtext,newtxmath,amsmath}', style_path: str | None = None) None[source]¶
Apply consistent Matplotlib rcParams across all high-level scripts.
Base rcParams are loaded from a bundled JSON file (mplstyle.json, or style_path if given) so plotting defaults can be tweaked without touching code. Runtime-dependent settings (LaTeX availability, figure size, DPI) stay as function arguments.
If LaTeX is not available, gracefully falls back to Matplotlib’s mathtext.
- pyrockfall.scripts._style.to_latex(s: str) str[source]¶
Escape LaTeX special characters in plain text labels.
- pyrockfall.scripts._style.latex_palette(name_to_hex: dict[str, str]) dict[str, str][source]¶
Map a {name: color} dict to a LaTeX-escaped version for plotting.
- pyrockfall.scripts._style.get_material_colors(*, latex_escape: bool = True, overrides: Mapping[str, str] | None = None) dict[str, str][source]¶
Return the (optionally LaTeX-escaped) material->color mapping. overrides lets callers tweak colors without changing the defaults.
- pyrockfall.scripts._style.ensure_palette_for(labels: Iterable[str], base_palette: Mapping[str, str] | None = None) dict[str, str][source]¶
Ensure every label has a colour. Uses base_palette for known labels and falls back to the Matplotlib color cycle for unknowns. Assumes labels are already LaTeX-escaped if base_palette keys are escaped.