From c2c9d0c12817fde3d2be24c420a93d63dd1cffe5 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:10:13 +0100 Subject: [PATCH 1/4] feat: reinstate title_prefix on all matplotlib subplot panel titles Analysis classes accept title_prefix: str = None to prefix every subplot panel title (e.g. "VIS " gives "VIS Data", "VIS Signal-To-Noise Map"). This was stored but never applied after a plot refactor. Thread title_prefix from Plotter.title_prefix down through all subplot_* plot functions across imaging, interferometer, quantity, ellipse, galaxies, and adapt paths. Co-Authored-By: Claude Sonnet 4.6 --- autogalaxy/analysis/plotter.py | 3 ++ autogalaxy/ellipse/model/plotter.py | 5 +++ autogalaxy/ellipse/plot/fit_ellipse_plots.py | 6 +++- autogalaxy/galaxy/plot/adapt_plots.py | 4 ++- autogalaxy/galaxy/plot/galaxies_plots.py | 16 +++++---- autogalaxy/imaging/model/plotter.py | 3 ++ autogalaxy/imaging/plot/fit_imaging_plots.py | 34 +++++++++++-------- autogalaxy/interferometer/model/plotter.py | 3 ++ .../plot/fit_interferometer_plots.py | 31 ++++++++++------- autogalaxy/quantity/model/plotter.py | 1 + .../quantity/plot/fit_quantity_plots.py | 22 ++++++------ 11 files changed, 84 insertions(+), 44 deletions(-) diff --git a/autogalaxy/analysis/plotter.py b/autogalaxy/analysis/plotter.py index 97928974..09e2cd4e 100644 --- a/autogalaxy/analysis/plotter.py +++ b/autogalaxy/analysis/plotter.py @@ -105,6 +105,7 @@ def should_plot(name): grid=grid, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("subplot_galaxies"): @@ -113,6 +114,7 @@ def should_plot(name): grid=grid, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_galaxy_images"): @@ -180,6 +182,7 @@ def should_plot(name): adapt_galaxy_name_image_dict=adapt_images.galaxy_name_image_dict, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_adapt_images"): diff --git a/autogalaxy/ellipse/model/plotter.py b/autogalaxy/ellipse/model/plotter.py index 96565bba..3dc49509 100644 --- a/autogalaxy/ellipse/model/plotter.py +++ b/autogalaxy/ellipse/model/plotter.py @@ -76,6 +76,7 @@ def should_plot(name): fit_list=fit_list, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("ellipse_residuals"): @@ -91,6 +92,7 @@ def should_plot(name): output_path=self.image_path, output_format=self.fmt, disable_data_contours=True, + title_prefix=self.title_prefix, ) if should_plot("subplot_fit_ellipse"): @@ -98,6 +100,7 @@ def should_plot(name): fit_list=fit_list, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) fit_ellipse_plots._plot_data( @@ -105,6 +108,7 @@ def should_plot(name): output_path=self.image_path, output_format=self.fmt, use_log10=True, + title_prefix=self.title_prefix, ) if should_plot("data_no_ellipse"): @@ -114,4 +118,5 @@ def should_plot(name): output_format=self.fmt, use_log10=True, disable_data_contours=True, + title_prefix=self.title_prefix, ) diff --git a/autogalaxy/ellipse/plot/fit_ellipse_plots.py b/autogalaxy/ellipse/plot/fit_ellipse_plots.py index 745ce5d6..28a2f3cf 100644 --- a/autogalaxy/ellipse/plot/fit_ellipse_plots.py +++ b/autogalaxy/ellipse/plot/fit_ellipse_plots.py @@ -21,6 +21,7 @@ def _plot_data( disable_data_contours: bool = False, suffix: str = "", ax=None, + title_prefix: str = None, ): """Plot the 2-D image data with fitted ellipse contours overlaid. @@ -61,9 +62,10 @@ def _plot_data( lines = [np.array(e.array) for e in ellipse_list if e is not None] positions = lines + _title = f"{title_prefix}Ellipse Fit" if title_prefix else "Ellipse Fit" plot_array( array=fit_list[0].data, - title="Ellipse Fit", + title=_title, output_path=output_path, output_filename=f"{output_filename}{suffix}", output_format=output_format, @@ -126,6 +128,7 @@ def subplot_fit_ellipse( colormap="default", use_log10=False, disable_data_contours: bool = False, + title_prefix: str = None, ): """Create a two-panel subplot summarising a list of ellipse fits. @@ -156,6 +159,7 @@ def subplot_fit_ellipse( use_log10=use_log10, disable_data_contours=disable_data_contours, ax=axes[0], + title_prefix=title_prefix, ) _plot_ellipse_residuals(fit_list=fit_list, for_subplot=True, ax=axes[1]) diff --git a/autogalaxy/galaxy/plot/adapt_plots.py b/autogalaxy/galaxy/plot/adapt_plots.py index f50ecb62..0deefe64 100644 --- a/autogalaxy/galaxy/plot/adapt_plots.py +++ b/autogalaxy/galaxy/plot/adapt_plots.py @@ -14,6 +14,7 @@ def subplot_adapt_images( output_format=None, colormap="default", use_log10=False, + title_prefix: str = None, ): """Create a subplot showing the adapt (model) image for each galaxy. @@ -48,10 +49,11 @@ def subplot_adapt_images( fig, axes = subplots(rows, cols, figsize=conf_subplot_figsize(rows, cols)) axes_list = [axes] if n == 1 else list(np.array(axes).flatten()) + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) for i, (_, galaxy_image) in enumerate(adapt_galaxy_name_image_dict.items()): plot_array( array=galaxy_image, - title="Galaxy Image", + title=_pf("Galaxy Image"), colormap=colormap, use_log10=use_log10, ax=axes_list[i], diff --git a/autogalaxy/galaxy/plot/galaxies_plots.py b/autogalaxy/galaxy/plot/galaxies_plots.py index 5ee76ea9..41806c31 100644 --- a/autogalaxy/galaxy/plot/galaxies_plots.py +++ b/autogalaxy/galaxy/plot/galaxies_plots.py @@ -73,6 +73,7 @@ def subplot_galaxies( tangential_critical_curves=None, radial_critical_curves=None, auto_filename="galaxies", + title_prefix: str = None, ): """Create a standard five-panel summary subplot for a collection of galaxies. @@ -129,12 +130,13 @@ def _defl_x(): d = gs.deflections_yx_2d_from(grid=grid) return aa.Array2D(values=d.slim[:, 1], mask=grid.mask) + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - ("image", gs.image_2d_from(grid=grid), "Image", pos_no_cc, None), - ("convergence", gs.convergence_2d_from(grid=grid), "Convergence", pos, lines), - ("potential", gs.potential_2d_from(grid=grid), "Potential", pos, lines), - ("deflections_y", _defl_y(), "Deflections Y", pos, lines), - ("deflections_x", _defl_x(), "Deflections X", pos, lines), + ("image", gs.image_2d_from(grid=grid), _pf("Image"), pos_no_cc, None), + ("convergence", gs.convergence_2d_from(grid=grid), _pf("Convergence"), pos, lines), + ("potential", gs.potential_2d_from(grid=grid), _pf("Potential"), pos, lines), + ("deflections_y", _defl_y(), _pf("Deflections Y"), pos, lines), + ("deflections_x", _defl_x(), _pf("Deflections X"), pos, lines), ] n = len(panels) @@ -168,6 +170,7 @@ def subplot_galaxy_images( use_log10=False, tangential_critical_curves=None, radial_critical_curves=None, + title_prefix: str = None, ): """Create a subplot showing the individual image of each galaxy. @@ -198,6 +201,7 @@ def subplot_galaxy_images( """ _check_no_linear(galaxies) gs = Galaxies(galaxies=galaxies) + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) n = len(gs) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) @@ -206,7 +210,7 @@ def subplot_galaxy_images( for i in range(n): plot_array( array=gs[i].image_2d_from(grid=grid), - title=f"Image Of Galaxies {i}", + title=_pf(f"Image Of Galaxies {i}"), colormap=colormap, use_log10=use_log10, ax=axes_flat[i], diff --git a/autogalaxy/imaging/model/plotter.py b/autogalaxy/imaging/model/plotter.py index 92f002e7..f6bdd490 100644 --- a/autogalaxy/imaging/model/plotter.py +++ b/autogalaxy/imaging/model/plotter.py @@ -83,6 +83,7 @@ def should_plot(name): fit=fit, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if quick_update: @@ -96,6 +97,7 @@ def should_plot(name): galaxy_index=galaxy_index, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_fit"): @@ -151,4 +153,5 @@ def should_plot(name): fit_list, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) diff --git a/autogalaxy/imaging/plot/fit_imaging_plots.py b/autogalaxy/imaging/plot/fit_imaging_plots.py index a2148fd0..e8248daa 100644 --- a/autogalaxy/imaging/plot/fit_imaging_plots.py +++ b/autogalaxy/imaging/plot/fit_imaging_plots.py @@ -16,6 +16,7 @@ def subplot_fit( use_log10=False, positions=None, residuals_symmetric_cmap: bool = True, + title_prefix: str = None, ): """Create a six-panel subplot summarising a :class:`~autogalaxy.imaging.fit_imaging.FitImaging`. @@ -40,13 +41,14 @@ def subplot_fit( Reserved for future symmetric-colormap support on residual panels (currently unused). """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.data, "Data", None), - (fit.signal_to_noise_map, "Signal-To-Noise Map", None), - (fit.model_data, "Model Image", None), - (fit.residual_map, "Residual Map", None), - (fit.normalized_residual_map, "Normalized Residual Map", None), - (fit.chi_squared_map, "Chi-Squared Map", r"$\chi^2$"), + (fit.data, _pf("Data"), None), + (fit.signal_to_noise_map, _pf("Signal-To-Noise Map"), None), + (fit.model_data, _pf("Model Image"), None), + (fit.residual_map, _pf("Residual Map"), None), + (fit.normalized_residual_map, _pf("Normalized Residual Map"), None), + (fit.chi_squared_map, _pf("Chi-Squared Map"), r"$\chi^2$"), ] n = len(panels) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) @@ -76,6 +78,7 @@ def subplot_of_galaxy( use_log10=False, positions=None, residuals_symmetric_cmap: bool = True, + title_prefix: str = None, ): """Create a three-panel subplot focused on a single galaxy contribution. @@ -103,15 +106,16 @@ def subplot_of_galaxy( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.data, "Data"), + (fit.data, _pf("Data")), ( fit.subtracted_images_of_galaxies_list[galaxy_index], - f"Subtracted Image of Galaxy {galaxy_index}", + _pf(f"Subtracted Image of Galaxy {galaxy_index}"), ), ( fit.model_images_of_galaxies_list[galaxy_index], - f"Model Image of Galaxy {galaxy_index}", + _pf(f"Model Image of Galaxy {galaxy_index}"), ), ] n = len(panels) @@ -136,6 +140,7 @@ def subplot_fit_imaging_list( output_path=None, output_filename: str = "fit_combined", output_format=None, + title_prefix: str = None, ): """ nĂ—5 subplot summarising a list of ``FitImaging`` objects. @@ -154,16 +159,17 @@ def subplot_fit_imaging_list( output_format File format string or list, e.g. ``"png"`` or ``["png"]``. """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) n = len(fit_list) fig, axes = subplots(n, 5, figsize=conf_subplot_figsize(n, 5)) if n == 1: axes = [axes] for i, fit in enumerate(fit_list): - plot_array(array=fit.data, title="Data", ax=axes[i][0]) - plot_array(array=fit.signal_to_noise_map, title="Signal-To-Noise Map", ax=axes[i][1]) - plot_array(array=fit.model_data, title="Model Image", ax=axes[i][2]) - plot_array(array=fit.normalized_residual_map, title="Normalized Residual Map", cb_unit=r"$\sigma$", ax=axes[i][3]) - plot_array(array=fit.chi_squared_map, title="Chi-Squared Map", cb_unit=r"$\chi^2$", ax=axes[i][4]) + plot_array(array=fit.data, title=_pf("Data"), ax=axes[i][0]) + plot_array(array=fit.signal_to_noise_map, title=_pf("Signal-To-Noise Map"), ax=axes[i][1]) + plot_array(array=fit.model_data, title=_pf("Model Image"), ax=axes[i][2]) + plot_array(array=fit.normalized_residual_map, title=_pf("Normalized Residual Map"), cb_unit=r"$\sigma$", ax=axes[i][3]) + plot_array(array=fit.chi_squared_map, title=_pf("Chi-Squared Map"), cb_unit=r"$\chi^2$", ax=axes[i][4]) tight_layout() _save_subplot(fig, output_path, output_filename, output_format) diff --git a/autogalaxy/interferometer/model/plotter.py b/autogalaxy/interferometer/model/plotter.py index 785b9c77..998e276c 100644 --- a/autogalaxy/interferometer/model/plotter.py +++ b/autogalaxy/interferometer/model/plotter.py @@ -83,6 +83,7 @@ def should_plot(name): fit=fit, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("subplot_fit_dirty_images") or quick_update: @@ -90,6 +91,7 @@ def should_plot(name): fit=fit, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if quick_update: @@ -100,6 +102,7 @@ def should_plot(name): fit=fit, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_galaxy_images"): diff --git a/autogalaxy/interferometer/plot/fit_interferometer_plots.py b/autogalaxy/interferometer/plot/fit_interferometer_plots.py index 25636d6f..68ea127e 100644 --- a/autogalaxy/interferometer/plot/fit_interferometer_plots.py +++ b/autogalaxy/interferometer/plot/fit_interferometer_plots.py @@ -18,6 +18,7 @@ def subplot_fit( colormap="default", use_log10=False, residuals_symmetric_cmap: bool = True, + title_prefix: str = None, ): """Create a three-panel subplot summarising a :class:`~autogalaxy.interferometer.fit_interferometer.FitInterferometer`. @@ -41,10 +42,11 @@ def subplot_fit( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.residual_map, "Residual Map"), - (fit.normalized_residual_map, "Normalized Residual Map"), - (fit.chi_squared_map, "Chi-Squared Map"), + (fit.residual_map, _pf("Residual Map")), + (fit.normalized_residual_map, _pf("Normalized Residual Map")), + (fit.chi_squared_map, _pf("Chi-Squared Map")), ] n = len(panels) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) @@ -64,6 +66,7 @@ def subplot_fit_dirty_images( colormap="default", use_log10=False, residuals_symmetric_cmap: bool = True, + title_prefix: str = None, ): """Create a six-panel subplot of dirty-image diagnostics for an interferometer fit. @@ -87,13 +90,14 @@ def subplot_fit_dirty_images( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.dirty_image, "Dirty Image", None), - (fit.dirty_signal_to_noise_map, "Dirty Signal-To-Noise Map", None), - (fit.dirty_model_image, "Dirty Model Image", None), - (fit.dirty_residual_map, "Dirty Residual Map", None), - (fit.dirty_normalized_residual_map, "Dirty Normalized Residual Map", r"$\sigma$"), - (fit.dirty_chi_squared_map, "Dirty Chi-Squared Map", r"$\chi^2$"), + (fit.dirty_image, _pf("Dirty Image"), None), + (fit.dirty_signal_to_noise_map, _pf("Dirty Signal-To-Noise Map"), None), + (fit.dirty_model_image, _pf("Dirty Model Image"), None), + (fit.dirty_residual_map, _pf("Dirty Residual Map"), None), + (fit.dirty_normalized_residual_map, _pf("Dirty Normalized Residual Map"), r"$\sigma$"), + (fit.dirty_chi_squared_map, _pf("Dirty Chi-Squared Map"), r"$\chi^2$"), ] n = len(panels) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) @@ -119,6 +123,7 @@ def subplot_fit_real_space( output_format=None, colormap="default", use_log10=False, + title_prefix: str = None, ): """Create a real-space summary subplot for an interferometer fit. @@ -156,12 +161,14 @@ def subplot_fit_real_space( colormap=colormap, use_log10=use_log10, auto_filename="fit_real_space", + title_prefix=title_prefix, ) else: + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.dirty_image, "Dirty Image"), - (fit.dirty_model_image, "Dirty Model Image"), - (fit.dirty_residual_map, "Dirty Residual Map"), + (fit.dirty_image, _pf("Dirty Image")), + (fit.dirty_model_image, _pf("Dirty Model Image")), + (fit.dirty_residual_map, _pf("Dirty Residual Map")), ] n = len(panels) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) diff --git a/autogalaxy/quantity/model/plotter.py b/autogalaxy/quantity/model/plotter.py index 089e054b..17b4594b 100644 --- a/autogalaxy/quantity/model/plotter.py +++ b/autogalaxy/quantity/model/plotter.py @@ -68,4 +68,5 @@ def should_plot(name): fit=fit, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) diff --git a/autogalaxy/quantity/plot/fit_quantity_plots.py b/autogalaxy/quantity/plot/fit_quantity_plots.py index 8f2d35fc..67e07a7a 100644 --- a/autogalaxy/quantity/plot/fit_quantity_plots.py +++ b/autogalaxy/quantity/plot/fit_quantity_plots.py @@ -6,7 +6,7 @@ from autogalaxy.util.plot_utils import plot_array, _save_subplot -def _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, positions, filename="fit"): +def _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, positions, filename="fit", title_prefix=None): """Render a six-panel fit summary subplot for a single array-valued quantity fit. The panels show: data, signal-to-noise map, model image, residual map, @@ -33,13 +33,14 @@ def _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, pos filename : str Output filename stem (default ``"subplot_fit"``). """ + _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) panels = [ - (fit.data, "Data"), - (fit.signal_to_noise_map, "Signal-To-Noise Map"), - (fit.model_data, "Model Image"), - (fit.residual_map, "Residual Map"), - (fit.normalized_residual_map, "Normalized Residual Map"), - (fit.chi_squared_map, "Chi-Squared Map"), + (fit.data, _pf("Data")), + (fit.signal_to_noise_map, _pf("Signal-To-Noise Map")), + (fit.model_data, _pf("Model Image")), + (fit.residual_map, _pf("Residual Map")), + (fit.normalized_residual_map, _pf("Normalized Residual Map")), + (fit.chi_squared_map, _pf("Chi-Squared Map")), ] n = len(panels) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) @@ -66,6 +67,7 @@ def subplot_fit( colormap="default", use_log10=False, positions=None, + title_prefix: str = None, ): """Create a summary subplot for a :class:`~autogalaxy.quantity.fit_quantity.FitQuantity`. @@ -93,11 +95,11 @@ def subplot_fit( Point positions to scatter-plot over each panel. """ if isinstance(fit.dataset.data, aa.Array2D): - _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, positions) + _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, positions, title_prefix=title_prefix) else: _subplot_fit_array( - fit.y, output_path, output_format, colormap, use_log10, positions, filename="fit_y" + fit.y, output_path, output_format, colormap, use_log10, positions, filename="fit_y", title_prefix=title_prefix ) _subplot_fit_array( - fit.x, output_path, output_format, colormap, use_log10, positions, filename="fit_x" + fit.x, output_path, output_format, colormap, use_log10, positions, filename="fit_x", title_prefix=title_prefix ) From 754e33dff3bbe7ce304041a0a34c060eac1d5951 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:28:45 +0100 Subject: [PATCH 2/4] fix: auto-space after title_prefix; pass prefix to dataset subplots All `_pf` lambdas now strip trailing whitespace from title_prefix and insert a single space before the panel title, so callers can pass either "VIS" or "VIS " and always get "VIS Data" (not "VISData" or "VIS Data"). The same fix is applied to the `_title` pattern in fit_ellipse_plots.py. PlotterImaging.imaging() and PlotterEllipse.imaging() now forward `title_prefix=self.title_prefix` to `subplot_imaging_dataset` / `subplot_imaging_dataset_list` so that dataset.png panels receive the prefix when a title_prefix is set on the Plotter. Co-Authored-By: Claude Opus 4.6 (1M context) --- autogalaxy/ellipse/model/plotter.py | 1 + autogalaxy/ellipse/plot/fit_ellipse_plots.py | 2 +- autogalaxy/galaxy/plot/adapt_plots.py | 2 +- autogalaxy/galaxy/plot/galaxies_plots.py | 4 ++-- autogalaxy/imaging/model/plotter.py | 2 ++ autogalaxy/imaging/plot/fit_imaging_plots.py | 6 +++--- autogalaxy/interferometer/plot/fit_interferometer_plots.py | 6 +++--- autogalaxy/quantity/plot/fit_quantity_plots.py | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/autogalaxy/ellipse/model/plotter.py b/autogalaxy/ellipse/model/plotter.py index 3dc49509..6be3cdb3 100644 --- a/autogalaxy/ellipse/model/plotter.py +++ b/autogalaxy/ellipse/model/plotter.py @@ -33,6 +33,7 @@ def should_plot(name): dataset, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) image_list = [ diff --git a/autogalaxy/ellipse/plot/fit_ellipse_plots.py b/autogalaxy/ellipse/plot/fit_ellipse_plots.py index 28a2f3cf..68855250 100644 --- a/autogalaxy/ellipse/plot/fit_ellipse_plots.py +++ b/autogalaxy/ellipse/plot/fit_ellipse_plots.py @@ -62,7 +62,7 @@ def _plot_data( lines = [np.array(e.array) for e in ellipse_list if e is not None] positions = lines - _title = f"{title_prefix}Ellipse Fit" if title_prefix else "Ellipse Fit" + _title = f"{title_prefix.rstrip()} Ellipse Fit" if title_prefix else "Ellipse Fit" plot_array( array=fit_list[0].data, title=_title, diff --git a/autogalaxy/galaxy/plot/adapt_plots.py b/autogalaxy/galaxy/plot/adapt_plots.py index 0deefe64..45e772bb 100644 --- a/autogalaxy/galaxy/plot/adapt_plots.py +++ b/autogalaxy/galaxy/plot/adapt_plots.py @@ -49,7 +49,7 @@ def subplot_adapt_images( fig, axes = subplots(rows, cols, figsize=conf_subplot_figsize(rows, cols)) axes_list = [axes] if n == 1 else list(np.array(axes).flatten()) - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) for i, (_, galaxy_image) in enumerate(adapt_galaxy_name_image_dict.items()): plot_array( array=galaxy_image, diff --git a/autogalaxy/galaxy/plot/galaxies_plots.py b/autogalaxy/galaxy/plot/galaxies_plots.py index 41806c31..f8a57afe 100644 --- a/autogalaxy/galaxy/plot/galaxies_plots.py +++ b/autogalaxy/galaxy/plot/galaxies_plots.py @@ -130,7 +130,7 @@ def _defl_x(): d = gs.deflections_yx_2d_from(grid=grid) return aa.Array2D(values=d.slim[:, 1], mask=grid.mask) - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ ("image", gs.image_2d_from(grid=grid), _pf("Image"), pos_no_cc, None), ("convergence", gs.convergence_2d_from(grid=grid), _pf("Convergence"), pos, lines), @@ -201,7 +201,7 @@ def subplot_galaxy_images( """ _check_no_linear(galaxies) gs = Galaxies(galaxies=galaxies) - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) n = len(gs) fig, axes = subplots(1, n, figsize=conf_subplot_figsize(1, n)) diff --git a/autogalaxy/imaging/model/plotter.py b/autogalaxy/imaging/model/plotter.py index f6bdd490..8448edd0 100644 --- a/autogalaxy/imaging/model/plotter.py +++ b/autogalaxy/imaging/model/plotter.py @@ -40,6 +40,7 @@ def should_plot(name): dataset, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_dataset"): @@ -130,6 +131,7 @@ def should_plot(name): dataset_list, output_path=self.image_path, output_format=self.fmt, + title_prefix=self.title_prefix, ) def fit_imaging_combined(self, fit_list: List[FitImaging]): diff --git a/autogalaxy/imaging/plot/fit_imaging_plots.py b/autogalaxy/imaging/plot/fit_imaging_plots.py index e8248daa..c7b45e10 100644 --- a/autogalaxy/imaging/plot/fit_imaging_plots.py +++ b/autogalaxy/imaging/plot/fit_imaging_plots.py @@ -41,7 +41,7 @@ def subplot_fit( Reserved for future symmetric-colormap support on residual panels (currently unused). """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.data, _pf("Data"), None), (fit.signal_to_noise_map, _pf("Signal-To-Noise Map"), None), @@ -106,7 +106,7 @@ def subplot_of_galaxy( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.data, _pf("Data")), ( @@ -159,7 +159,7 @@ def subplot_fit_imaging_list( output_format File format string or list, e.g. ``"png"`` or ``["png"]``. """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) n = len(fit_list) fig, axes = subplots(n, 5, figsize=conf_subplot_figsize(n, 5)) if n == 1: diff --git a/autogalaxy/interferometer/plot/fit_interferometer_plots.py b/autogalaxy/interferometer/plot/fit_interferometer_plots.py index 68ea127e..bade136a 100644 --- a/autogalaxy/interferometer/plot/fit_interferometer_plots.py +++ b/autogalaxy/interferometer/plot/fit_interferometer_plots.py @@ -42,7 +42,7 @@ def subplot_fit( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.residual_map, _pf("Residual Map")), (fit.normalized_residual_map, _pf("Normalized Residual Map")), @@ -90,7 +90,7 @@ def subplot_fit_dirty_images( residuals_symmetric_cmap : bool Reserved for future symmetric-colormap support (currently unused). """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.dirty_image, _pf("Dirty Image"), None), (fit.dirty_signal_to_noise_map, _pf("Dirty Signal-To-Noise Map"), None), @@ -164,7 +164,7 @@ def subplot_fit_real_space( title_prefix=title_prefix, ) else: - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.dirty_image, _pf("Dirty Image")), (fit.dirty_model_image, _pf("Dirty Model Image")), diff --git a/autogalaxy/quantity/plot/fit_quantity_plots.py b/autogalaxy/quantity/plot/fit_quantity_plots.py index 67e07a7a..2d60ee20 100644 --- a/autogalaxy/quantity/plot/fit_quantity_plots.py +++ b/autogalaxy/quantity/plot/fit_quantity_plots.py @@ -33,7 +33,7 @@ def _subplot_fit_array(fit, output_path, output_format, colormap, use_log10, pos filename : str Output filename stem (default ``"subplot_fit"``). """ - _pf = (lambda t: f"{title_prefix}{t}") if title_prefix else (lambda t: t) + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) panels = [ (fit.data, _pf("Data")), (fit.signal_to_noise_map, _pf("Signal-To-Noise Map")), From 443724ca9e8d4aeb044397532b79e78177661d64 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:34:51 +0100 Subject: [PATCH 3/4] feat: pass title_prefix to subplot_of_mapper in Plotter.inversion() Co-Authored-By: Claude Opus 4.6 (1M context) --- autogalaxy/analysis/plotter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autogalaxy/analysis/plotter.py b/autogalaxy/analysis/plotter.py index 09e2cd4e..ad2523d8 100644 --- a/autogalaxy/analysis/plotter.py +++ b/autogalaxy/analysis/plotter.py @@ -153,6 +153,7 @@ def should_plot(name): output_path=output.path, output_filename=f"inversion_{i}", output_format=fmt, + title_prefix=self.title_prefix, ) if should_plot("csv_reconstruction"): From 176cfa274930807df72700354f62ec6468016697 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:40:01 +0100 Subject: [PATCH 4/4] feat: pass title_prefix to subplot_interferometer_dataset Co-Authored-By: Claude Opus 4.6 (1M context) --- autogalaxy/interferometer/model/plotter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/autogalaxy/interferometer/model/plotter.py b/autogalaxy/interferometer/model/plotter.py index 998e276c..ef6306bd 100644 --- a/autogalaxy/interferometer/model/plotter.py +++ b/autogalaxy/interferometer/model/plotter.py @@ -37,6 +37,7 @@ def should_plot(name): output_path=self.image_path, output_filename="dataset", output_format=self.fmt[0] if isinstance(self.fmt, (list, tuple)) else self.fmt, + title_prefix=self.title_prefix, ) if should_plot("fits_dataset"):