SPB Git forge

spb/wp8_uqo

Public
3commits 1branches 1releases
4.2 MBsize
maindefault branch
2 h agolast push
Python 56.2% TeX 43.7%
739 B · 28 lines python
Raw Blame History
1"""Journal of Finance publication-quality plotting style."""23from __future__ import annotations45from pathlib import Path67import matplotlib.pyplot as plt89from src.config import FIGURES, JOF_COLORS, MPL_STYLE101112def set_jof_style() -> None:13    """Apply Journal of Finance matplotlib style."""14    plt.rcParams.update(MPL_STYLE)151617def save_figure(fig: plt.Figure, name: str, formats: list[str] | None = None) -> None:18    """Save figure to FIGURES directory in PDF and PNG."""19    if formats is None:20        formats = ["pdf", "png"]21    FIGURES.mkdir(parents=True, exist_ok=True)22    for fmt in formats:23        fig.savefig(FIGURES / f"{name}.{fmt}", bbox_inches="tight", dpi=300)24    plt.close(fig)252627COLORS = list(JOF_COLORS.values())28