From ec5745b3a9e6b39716f5c9179bc5697ae0b07abf Mon Sep 17 00:00:00 2001 From: runame Date: Sat, 29 Apr 2023 17:46:57 +0200 Subject: [PATCH 1/2] Add NeurIPS 2023 style --- tueplots/bundles.py | 11 +++++++++++ tueplots/figsizes.py | 22 ++++++++++++++++++++++ tueplots/fonts.py | 10 ++++++++++ tueplots/fontsizes.py | 5 +++++ 4 files changed, 48 insertions(+) diff --git a/tueplots/bundles.py b/tueplots/bundles.py index 08760dc..ac060ee 100644 --- a/tueplots/bundles.py +++ b/tueplots/bundles.py @@ -89,6 +89,17 @@ def neurips2022(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif") return {**font_config, **size, **fontsize_config} +def neurips2023(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif"): + """Neurips 2023 bundle.""" + if usetex is True: + font_config = fonts.neurips2023_tex(family=family) + elif usetex is False: + font_config = fonts.neurips2023(family=family) + size = figsizes.neurips2023(rel_width=rel_width, nrows=nrows, ncols=ncols) + fontsize_config = fontsizes.neurips2023() + return {**font_config, **size, **fontsize_config} + + def iclr2023(*, usetex=True, rel_width=1.0, nrows=1, ncols=1, family="serif"): """ICLR 2023 bundle.""" if usetex is True: diff --git a/tueplots/figsizes.py b/tueplots/figsizes.py index 0d6cdcc..cb35f6e 100644 --- a/tueplots/figsizes.py +++ b/tueplots/figsizes.py @@ -307,6 +307,28 @@ def neurips2022( ) +def neurips2023( + *, + rel_width=1.0, + nrows=1, + ncols=2, + constrained_layout=True, + tight_layout=False, + height_to_width_ratio=_GOLDEN_RATIO, + pad_inches=_PAD_INCHES, +): + """Neurips 2023 figure size.""" + return _neurips_and_iclr_common( + rel_width=rel_width, + nrows=nrows, + ncols=ncols, + constrained_layout=constrained_layout, + tight_layout=tight_layout, + height_to_width_ratio=height_to_width_ratio, + pad_inches=pad_inches, + ) + + def iclr2023( *, rel_width=1.0, diff --git a/tueplots/fonts.py b/tueplots/fonts.py index 35ff8b6..68e1eb7 100644 --- a/tueplots/fonts.py +++ b/tueplots/fonts.py @@ -21,6 +21,16 @@ def neurips2022_tex(*, family="serif"): return _neurips_and_iclr_tex_common(family=family) +def neurips2023(*, family="serif"): + """Fonts for Neurips 2023.""" + return _neurips_and_iclr_common(family=family) + + +def neurips2023_tex(*, family="serif"): + """Fonts for Neurips 2023. LaTeX version.""" + return _neurips_and_iclr_tex_common(family=family) + + def iclr2023_tex(*, family="serif"): """Fonts for ICLR 2023. LaTeX version.""" return _neurips_and_iclr_tex_common(family=family) diff --git a/tueplots/fontsizes.py b/tueplots/fontsizes.py index 2314d8c..770dff4 100644 --- a/tueplots/fontsizes.py +++ b/tueplots/fontsizes.py @@ -21,6 +21,11 @@ def neurips2022(*, default_smaller=1): return _from_base(base=10 - default_smaller) +def neurips2023(*, default_smaller=1): + """Font size for Neurips 2023.""" + return _from_base(base=10 - default_smaller) + + def iclr2023(*, default_smaller=1): """Font size for ICLR 2023.""" return _from_base(base=10 - default_smaller) From 9041d3f21165a9f306f38fdfc151195374e2e1c1 Mon Sep 17 00:00:00 2001 From: runame Date: Sat, 29 Apr 2023 17:47:22 +0200 Subject: [PATCH 2/2] Add tests for NeurIPS 2023 style --- tests/test_rc_params_cases/case_bundles.py | 5 +++++ tests/test_rc_params_cases/case_figsizes.py | 4 ++++ tests/test_rc_params_cases/case_fonts.py | 16 ++++++++++++++++ tests/test_rc_params_cases/case_fontsizes.py | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/tests/test_rc_params_cases/case_bundles.py b/tests/test_rc_params_cases/case_bundles.py index 8c75ad5..6222654 100644 --- a/tests/test_rc_params_cases/case_bundles.py +++ b/tests/test_rc_params_cases/case_bundles.py @@ -33,6 +33,11 @@ def case_bundles_neurips2022(usetex): return bundles.neurips2022(usetex=usetex, nrows=2, ncols=2, family="serif") +@pytest_cases.parametrize(usetex=[True, False]) +def case_bundles_neurips2023(usetex): + return bundles.neurips2023(usetex=usetex, nrows=2, ncols=2, family="serif") + + @pytest_cases.parametrize(usetex=[True, False]) def case_bundles_iclr2023(usetex): return bundles.iclr2023(usetex=usetex, nrows=2, ncols=2, family="serif") diff --git a/tests/test_rc_params_cases/case_figsizes.py b/tests/test_rc_params_cases/case_figsizes.py index 25aa97f..8b22675 100644 --- a/tests/test_rc_params_cases/case_figsizes.py +++ b/tests/test_rc_params_cases/case_figsizes.py @@ -44,6 +44,10 @@ def case_figsizes_neurips2022(): return figsizes.neurips2022(nrows=2, ncols=3, height_to_width_ratio=1.0) +def case_figsizes_neurips2023(): + return figsizes.neurips2023(nrows=2, ncols=3, height_to_width_ratio=1.0) + + def case_figsizes_iclr2023(): return figsizes.iclr2023(nrows=2, ncols=3, height_to_width_ratio=1.0) diff --git a/tests/test_rc_params_cases/case_fonts.py b/tests/test_rc_params_cases/case_fonts.py index a743c46..e61af6b 100644 --- a/tests/test_rc_params_cases/case_fonts.py +++ b/tests/test_rc_params_cases/case_fonts.py @@ -52,6 +52,22 @@ def case_fonts_neurips2022_tex_custom(): return fonts.neurips2022_tex(family="serif") +def case_fonts_neurips2023_default(): + return fonts.neurips2023() + + +def case_fonts_neurips2023_custom(): + return fonts.neurips2023(family="serif") + + +def case_fonts_neurips2023_tex_default(): + return fonts.neurips2023_tex() + + +def case_fonts_neurips2023_tex_custom(): + return fonts.neurips2023_tex(family="serif") + + def case_fonts_iclr2023_tex_default(): return fonts.iclr2023_tex() diff --git a/tests/test_rc_params_cases/case_fontsizes.py b/tests/test_rc_params_cases/case_fontsizes.py index 613653a..93a3362 100644 --- a/tests/test_rc_params_cases/case_fontsizes.py +++ b/tests/test_rc_params_cases/case_fontsizes.py @@ -15,6 +15,10 @@ def case_fontsizes_neurips2022(): return fontsizes.neurips2022() +def case_fontsizes_neurips2023(): + return fontsizes.neurips2023() + + def case_fontsizes_iclr2023(): return fontsizes.iclr2023()