# Author: Simon-Pierre Boucher — contact@spboucher.ai """ Shared matplotlib configuration. Two publication styles are used in the original pipeline and are preserved exactly so regenerated figures match the originals: - `use_descriptive_style()` — seaborn whitegrid, used by the descriptive figures (script 05). - `use_publication_style()` — serif fonts, used by the ML robustness and additional-figures scripts (scripts 09 and 10). """ import matplotlib matplotlib.use("Agg") # non-interactive backend import matplotlib.pyplot as plt # noqa: E402 (backend must be set first) def use_descriptive_style() -> None: """Style for the descriptive tables/figures script.""" plt.style.use("seaborn-v0_8-whitegrid") plt.rcParams.update({ "font.size": 11, "axes.titlesize": 13, "axes.labelsize": 12, "xtick.labelsize": 10, "ytick.labelsize": 10, "figure.dpi": 150, "savefig.dpi": 300, "savefig.bbox": "tight", "pdf.fonttype": 42, # TrueType for journal submission }) def use_publication_style() -> None: """Serif style for the ML and robustness figure scripts.""" plt.rcParams.update({ "font.family": "serif", "font.size": 10, "axes.titlesize": 12, "axes.labelsize": 11, "figure.figsize": (7, 5), "figure.dpi": 150, "savefig.bbox": "tight", "savefig.pad_inches": 0.05, })