Flatten plot API: replace Plotter classes with module-level functions#1174
Merged
Jammy2211 merged 2 commits intomain_buildfrom Apr 3, 2026
Merged
Flatten plot API: replace Plotter classes with module-level functions#1174Jammy2211 merged 2 commits intomain_buildfrom
Jammy2211 merged 2 commits intomain_buildfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 5, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the class-based plotting API (
NestPlotter,MCMCPlotter,MLEPlotter,SamplesPlotter) with simple module-level functions. Users now callaplt.corner_anesthetic(samples=samples)instead of instantiating a plotter object. All cross-cutting concerns (test-mode skipping, convergence error handling) are preserved as decorators in a newplot_util.py.API Changes
The
autofit.plotmodule no longer exports Plotter classes. All plotting is now done via flat functions that takesamplesas the first argument, with optionalpath,filename, andformatkwargs for output control.NestPlotter,MCMCPlotter,MLEPlotter,SamplesPlotter,Outputcorner_cornerpy(),corner_anesthetic(),subplot_parameters(),log_likelihood_vs_iteration(),output_figure()See full details below.
Test Plan
pytest test_autofit/ -x— 390 passed (1 pre-existing failure intest_covariance.pyalso fails onmain_build)py_compilesyntax checkgrepconfirms no stale references to old Plotter classes in source📋 Full API Changes (for automation & release notes)
Removed
aplt.NestPlotterclass — useaplt.corner_anesthetic()function insteadaplt.MCMCPlotterclass — useaplt.corner_cornerpy()function insteadaplt.MLEPlotterclass — useaplt.subplot_parameters()/aplt.log_likelihood_vs_iteration()insteadaplt.SamplesPlotterclass — base class, no longer neededaplt.Outputclass — output now handled viapath,filename,formatkwargs on each functionautofit.non_linear.plot.outputmodule — deletedautofit.non_linear.plot.mcmc_plottersmodule — deletedAdded
aplt.corner_cornerpy(samples, path=None, filename="corner", format="show", **kwargs)— corner plot via corner.pyaplt.corner_anesthetic(samples, path=None, filename="corner_anesthetic", format="show", **kwargs)— corner plot via anestheticaplt.subplot_parameters(samples, use_log_y=False, use_last_50_percent=False, path=None, filename="subplot_parameters", format="show")— parameter vs iteration subplotsaplt.log_likelihood_vs_iteration(samples, use_log_y=False, use_last_50_percent=False, path=None, filename="log_likelihood_vs_iteration", format="show")— log likelihood vs iterationaplt.output_figure(path=None, filename="figure", format="show")— utility for saving/showing figuresautofit.non_linear.plot.plot_utilmodule — shared decorators (skip_in_test_mode,log_plot_exception) andoutput_figureMigration
plotter = aplt.NestPlotter(samples=s); plotter.corner_anesthetic()aplt.corner_anesthetic(samples=s)plotter = aplt.MCMCPlotter(samples=s); plotter.corner_cornerpy(**kw)aplt.corner_cornerpy(samples=s, **kw)plotter = aplt.MLEPlotter(samples=s); plotter.subplot_parameters(use_log_y=True)aplt.subplot_parameters(samples=s, use_log_y=True)Output(path=p, format="png")with kwargs:path=p, format="png"on each function call🤖 Generated with Claude Code