From 6198bbacb4018758a72b08e0dc5e3512a00384ef Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Aug 2026 20:57:15 +0000 Subject: [PATCH] docs: correct the plot tutorials' corner.py kwarg lists and forwarding claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pairs with PyAutoFit#1523, which makes `autofit.plot` forward its `**kwargs` to the library each function wraps and reject what that library cannot honour. The four plot scripts each stated that their kwargs are "passed in ... as described in the API docs", but three of the four had copied their list from a *different* sampler's plotting API. `corner_cornerpy` wraps `corner.py`, so against corner's real signature those arguments were never going to apply: dynesty_plotter.py dims, span, quantiles_2d, hist2d_kwargs, truth_kwargs zeus_plotter.py weight_list, span, truth, alpha, linewidth, fill, fontsize, title_fontsize, cut, size nautilus_plotter.py panelsize, xticksize, yticksize Under the library's new guard these would now raise, so each list is rewritten to genuine `corner.py` arguments. `emcee_plotter.py`'s 30 kwargs were already all corner's and are unchanged. The prose in every script now says the kwargs go to `corner.corner` and that an unrecognised name raises, and dynesty's and nautilus's `_kwargs` paragraphs no longer point the reader at their own sampler's plotting docs for arguments corner will receive. Verified by rendering each script's exact kwarg list through the real `corner_cornerpy` against corner 2.2.2 — all four produce a figure. Notebooks regenerated with PyAutoHands `generate.py autofit`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01G8EXazf2FEqf4S9UpTwMGV --- notebooks/plot/dynesty_plotter.ipynb | 18 ++++++++---------- notebooks/plot/emcee_plotter.ipynb | 6 ++++-- notebooks/plot/nautilus_plotter.ipynb | 19 +++++++++---------- notebooks/plot/zeus_plotter.ipynb | 25 +++++++++++-------------- scripts/plot/dynesty_plotter.py | 18 ++++++++---------- scripts/plot/emcee_plotter.py | 6 ++++-- scripts/plot/nautilus_plotter.py | 19 +++++++++---------- scripts/plot/zeus_plotter.py | 25 +++++++++++-------------- 8 files changed, 64 insertions(+), 72 deletions(-) diff --git a/notebooks/plot/dynesty_plotter.ipynb b/notebooks/plot/dynesty_plotter.ipynb index b7d63fc6..9b770d24 100644 --- a/notebooks/plot/dynesty_plotter.ipynb +++ b/notebooks/plot/dynesty_plotter.ipynb @@ -155,17 +155,20 @@ " - https://dynesty.readthedocs.io/en/latest/quickstart.html\n", " - https://dynesty.readthedocs.io/en/latest/api.html#module-dynesty.plotting\n", "\n", - "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are\n", - "described in the API docs.\n", + "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described\n", + "in the `corner.py` API docs \u2014 they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a\n", + "`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of\n", + "being quietly ignored.\n", "\n", - "Dynesty plotters use `_kwargs` dictionaries to pass visualization settings to matplotlib lib. For example, below,\n", + "`corner.py` uses `_kwargs` dictionaries to pass visualization settings through to matplotlib. For example, below,\n", "we:\n", "\n", " - Set the fontsize of the x and y labels by passing `label_kwargs={\"fontsize\": 16}`.\n", " - Set the fontsize of the title by passing `title_kwargs={\"fontsize\": \"10\"}`.\n", "\n", - "There are other `_kwargs` inputs we pass as None, you should check out the Dynesty docs if you need to customize your\n", - "figure.\n", + "There are other `_kwargs` inputs we pass as None; check out the `corner.py` docs if you need to customize your\n", + "figure further. Note that these are `corner.py`'s options, not dynesty's \u2014 `corner_cornerpy` wraps `corner.py`,\n", + "so dynesty's own `cornerplot` arguments (`dims`, `span`, `quantiles_2d`, \u2026) do not apply here.\n", "\n", "The `corner_anesthetic` function produces a triangle of 1D and 2D PDF's of every parameter using the library `anesthetic`." ] @@ -192,21 +195,16 @@ "source": [ "aplt.corner_cornerpy(\n", " samples=samples,\n", - " dims=None,\n", - " span=None,\n", " quantiles=[0.025, 0.5, 0.975],\n", " color=\"black\",\n", " smooth=0.02,\n", - " quantiles_2d=None,\n", " hist_kwargs=None,\n", - " hist2d_kwargs=None,\n", " label_kwargs={\"fontsize\": 16},\n", " show_titles=True,\n", " title_fmt=\".2f\",\n", " title_kwargs={\"fontsize\": \"10\"},\n", " truths=None,\n", " truth_color=\"red\",\n", - " truth_kwargs=None,\n", " max_n_ticks=5,\n", " top_ticks=False,\n", " use_math_text=False,\n", diff --git a/notebooks/plot/emcee_plotter.ipynb b/notebooks/plot/emcee_plotter.ipynb index 25245582..04ecdab0 100644 --- a/notebooks/plot/emcee_plotter.ipynb +++ b/notebooks/plot/emcee_plotter.ipynb @@ -161,8 +161,10 @@ "\n", "- https://corner.readthedocs.io/en/latest/index.html\n", "\n", - "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are\n", - "described in the API docs." + "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described\n", + "in the `corner.py` API docs \u2014 they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a\n", + "`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of\n", + "being quietly ignored." ] }, { diff --git a/notebooks/plot/nautilus_plotter.ipynb b/notebooks/plot/nautilus_plotter.ipynb index 638e5925..91125293 100644 --- a/notebooks/plot/nautilus_plotter.ipynb +++ b/notebooks/plot/nautilus_plotter.ipynb @@ -158,17 +158,19 @@ "\n", " - https://nautilus-sampler.readthedocs.io/en/stable/guides/crash_course.html\n", "\n", - "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are\n", - "described in the API docs.\n", + "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described\n", + "in the `corner.py` API docs \u2014 they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a\n", + "`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of\n", + "being quietly ignored.\n", "\n", - "Nautilus plotters use `_kwargs` dictionaries to pass visualization settings to matplotlib lib. For example, below,\n", + "`corner.py` uses `_kwargs` dictionaries to pass visualization settings through to matplotlib. For example, below,\n", "we:\n", "\n", - " - Set the fontsize of the x and y labels by passing `label_kwargs={\"fontsize\": 16}`.\n", - " - Set the fontsize of the title by passing `title_kwargs={\"fontsize\": \"10\"}`.\n", + " - Set the fontsize of the x and y labels by passing `label_kwargs={\"fontsize\": 24}`.\n", "\n", - "There are other `_kwargs` inputs we pass as None, you should check out the Nautilus docs if you need to customize your\n", - "figure.\n", + "Check out the `corner.py` docs if you need to customize your figure further. Note that these are `corner.py`'s\n", + "options, not nautilus's \u2014 `corner_cornerpy` wraps `corner.py`, so figure-geometry arguments from other plotting\n", + "libraries (`panelsize`, `xticksize`, `yticksize`, \u2026) do not apply here.\n", "\n", "The `corner_anesthetic` function produces a triangle of 1D and 2D PDF's of every parameter using the library `anesthetic`." ] @@ -195,9 +197,6 @@ "source": [ "aplt.corner_cornerpy(\n", " samples=samples,\n", - " panelsize=3.5,\n", - " yticksize=16,\n", - " xticksize=16,\n", " bins=20,\n", " plot_datapoints=False,\n", " plot_density=False,\n", diff --git a/notebooks/plot/zeus_plotter.ipynb b/notebooks/plot/zeus_plotter.ipynb index c61c12a0..992cde12 100644 --- a/notebooks/plot/zeus_plotter.ipynb +++ b/notebooks/plot/zeus_plotter.ipynb @@ -157,15 +157,19 @@ "\n", "The zeus readthedocs describes fully all of the methods used below\n", "\n", - " - https://zeus-mcmc.readthedocs.io/en/latest/api/plotting.html#cornerplot\n", " - https://zeus-mcmc.readthedocs.io/en/latest/notebooks/normal_distribution.html\n", "\n", + "Note that `corner_cornerpy` wraps `corner.py`, not zeus's own `cornerplot` \u2014 zeus's arguments\n", + "(`weight_list`, `span`, `truth`, `fill`, `cut`, `size`, \u2026) are not accepted here.\n", + "\n", "The `aplt.corner_cornerpy` function wraps the library `corner.py` to make corner plots of the PDF:\n", "\n", "- https://corner.readthedocs.io/en/latest/index.html\n", "\n", - "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are\n", - "described in the API docs.\n", + "In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described\n", + "in the `corner.py` API docs \u2014 they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a\n", + "`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of\n", + "being quietly ignored.\n", "\n", "The `corner_cornerpy` function produces a triangle of 1D and 2D PDF's of every parameter using the library `corner.py`." ] @@ -176,22 +180,15 @@ "source": [ "aplt.corner_cornerpy(\n", " samples=samples,\n", - " weight_list=None,\n", - " levels=None,\n", - " span=None,\n", " quantiles=[0.025, 0.5, 0.975],\n", - " truth=None,\n", + " levels=(0.68, 0.95),\n", " color=None,\n", - " alpha=0.5,\n", - " linewidth=1.5,\n", - " fill=True,\n", - " fontsize=10,\n", " show_titles=True,\n", " title_fmt=\".2f\",\n", - " title_fontsize=12,\n", - " cut=3,\n", + " title_kwargs={\"fontsize\": 12},\n", + " label_kwargs={\"fontsize\": 10},\n", + " truths=None,\n", " fig=None,\n", - " size=(10, 10),\n", ")\n" ], "outputs": [], diff --git a/scripts/plot/dynesty_plotter.py b/scripts/plot/dynesty_plotter.py index 9805eb13..384dd2a4 100644 --- a/scripts/plot/dynesty_plotter.py +++ b/scripts/plot/dynesty_plotter.py @@ -79,17 +79,20 @@ - https://dynesty.readthedocs.io/en/latest/quickstart.html - https://dynesty.readthedocs.io/en/latest/api.html#module-dynesty.plotting -In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are -described in the API docs. +In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described +in the `corner.py` API docs — they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a +`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of +being quietly ignored. -Dynesty plotters use `_kwargs` dictionaries to pass visualization settings to matplotlib lib. For example, below, +`corner.py` uses `_kwargs` dictionaries to pass visualization settings through to matplotlib. For example, below, we: - Set the fontsize of the x and y labels by passing `label_kwargs={"fontsize": 16}`. - Set the fontsize of the title by passing `title_kwargs={"fontsize": "10"}`. -There are other `_kwargs` inputs we pass as None, you should check out the Dynesty docs if you need to customize your -figure. +There are other `_kwargs` inputs we pass as None; check out the `corner.py` docs if you need to customize your +figure further. Note that these are `corner.py`'s options, not dynesty's — `corner_cornerpy` wraps `corner.py`, +so dynesty's own `cornerplot` arguments (`dims`, `span`, `quantiles_2d`, …) do not apply here. The `corner_anesthetic` function produces a triangle of 1D and 2D PDF's of every parameter using the library `anesthetic`. """ @@ -100,21 +103,16 @@ """ aplt.corner_cornerpy( samples=samples, - dims=None, - span=None, quantiles=[0.025, 0.5, 0.975], color="black", smooth=0.02, - quantiles_2d=None, hist_kwargs=None, - hist2d_kwargs=None, label_kwargs={"fontsize": 16}, show_titles=True, title_fmt=".2f", title_kwargs={"fontsize": "10"}, truths=None, truth_color="red", - truth_kwargs=None, max_n_ticks=5, top_ticks=False, use_math_text=False, diff --git a/scripts/plot/emcee_plotter.py b/scripts/plot/emcee_plotter.py index 00025590..0dc0cdf3 100644 --- a/scripts/plot/emcee_plotter.py +++ b/scripts/plot/emcee_plotter.py @@ -85,8 +85,10 @@ - https://corner.readthedocs.io/en/latest/index.html -In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are -described in the API docs. +In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described +in the `corner.py` API docs — they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a +`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of +being quietly ignored. """ samples = result.samples diff --git a/scripts/plot/nautilus_plotter.py b/scripts/plot/nautilus_plotter.py index ec12ca25..353c1ee1 100644 --- a/scripts/plot/nautilus_plotter.py +++ b/scripts/plot/nautilus_plotter.py @@ -82,17 +82,19 @@ - https://nautilus-sampler.readthedocs.io/en/stable/guides/crash_course.html -In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are -described in the API docs. +In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described +in the `corner.py` API docs — they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a +`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of +being quietly ignored. -Nautilus plotters use `_kwargs` dictionaries to pass visualization settings to matplotlib lib. For example, below, +`corner.py` uses `_kwargs` dictionaries to pass visualization settings through to matplotlib. For example, below, we: - - Set the fontsize of the x and y labels by passing `label_kwargs={"fontsize": 16}`. - - Set the fontsize of the title by passing `title_kwargs={"fontsize": "10"}`. + - Set the fontsize of the x and y labels by passing `label_kwargs={"fontsize": 24}`. -There are other `_kwargs` inputs we pass as None, you should check out the Nautilus docs if you need to customize your -figure. +Check out the `corner.py` docs if you need to customize your figure further. Note that these are `corner.py`'s +options, not nautilus's — `corner_cornerpy` wraps `corner.py`, so figure-geometry arguments from other plotting +libraries (`panelsize`, `xticksize`, `yticksize`, …) do not apply here. The `corner_anesthetic` function produces a triangle of 1D and 2D PDF's of every parameter using the library `anesthetic`. """ @@ -103,9 +105,6 @@ """ aplt.corner_cornerpy( samples=samples, - panelsize=3.5, - yticksize=16, - xticksize=16, bins=20, plot_datapoints=False, plot_density=False, diff --git a/scripts/plot/zeus_plotter.py b/scripts/plot/zeus_plotter.py index 8902e389..b66a25c0 100644 --- a/scripts/plot/zeus_plotter.py +++ b/scripts/plot/zeus_plotter.py @@ -81,36 +81,33 @@ The zeus readthedocs describes fully all of the methods used below - - https://zeus-mcmc.readthedocs.io/en/latest/api/plotting.html#cornerplot - https://zeus-mcmc.readthedocs.io/en/latest/notebooks/normal_distribution.html +Note that `corner_cornerpy` wraps `corner.py`, not zeus's own `cornerplot` — zeus's arguments +(`weight_list`, `span`, `truth`, `fill`, `cut`, `size`, …) are not accepted here. + The `aplt.corner_cornerpy` function wraps the library `corner.py` to make corner plots of the PDF: - https://corner.readthedocs.io/en/latest/index.html -In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters that are -described in the API docs. +In all the examples below, we use the `kwargs` of this function to pass in any of the input parameters described +in the `corner.py` API docs — they are forwarded to `corner.corner`. A name `corner.py` does not accept raises a +`TypeError` naming it, so a typo, or an argument belonging to a different plotting library, fails loudly instead of +being quietly ignored. The `corner_cornerpy` function produces a triangle of 1D and 2D PDF's of every parameter using the library `corner.py`. """ aplt.corner_cornerpy( samples=samples, - weight_list=None, - levels=None, - span=None, quantiles=[0.025, 0.5, 0.975], - truth=None, + levels=(0.68, 0.95), color=None, - alpha=0.5, - linewidth=1.5, - fill=True, - fontsize=10, show_titles=True, title_fmt=".2f", - title_fontsize=12, - cut=3, + title_kwargs={"fontsize": 12}, + label_kwargs={"fontsize": 10}, + truths=None, fig=None, - size=(10, 10), )