"""Journal of Finance publication-quality plotting style.""" from __future__ import annotations from pathlib import Path import matplotlib.pyplot as plt from src.config import FIGURES, JOF_COLORS, MPL_STYLE def set_jof_style() -> None: """Apply Journal of Finance matplotlib style.""" plt.rcParams.update(MPL_STYLE) def save_figure(fig: plt.Figure, name: str, formats: list[str] | None = None) -> None: """Save figure to FIGURES directory in PDF and PNG.""" if formats is None: formats = ["pdf", "png"] FIGURES.mkdir(parents=True, exist_ok=True) for fmt in formats: fig.savefig(FIGURES / f"{name}.{fmt}", bbox_inches="tight", dpi=300) plt.close(fig) COLORS = list(JOF_COLORS.values())