diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py index 49ddc3ea0f5..2935ce6f2ca 100644 --- a/yt/visualization/plot_modifications.py +++ b/yt/visualization/plot_modifications.py @@ -30,7 +30,11 @@ ) from yt.utilities.math_utils import periodic_ray from yt.utilities.on_demand_imports import NotAModule -from yt.visualization._commons import _swap_arg_pair_order, _swap_axes_extents +from yt.visualization._commons import ( + _swap_arg_pair_order, + _swap_axes_extents, + invalidate_plot, +) from yt.visualization.base_plot_types import CallbackWrapper from yt.visualization.image_writer import apply_colormap from yt.visualization.plot_window import PWViewerMPL @@ -83,6 +87,7 @@ def __init_subclass__(cls, *args, **kwargs): incompatible_plot_types = cls._incompatible_plot_types type_name = cls._type_name + @invalidate_plot def closure(self, *args, **kwargs): nonlocal supported_geometries nonlocal incompatible_plot_types @@ -101,6 +106,7 @@ def closure(self, *args, **kwargs): if self._plot_type in incompatible_plot_types: raise YTUnsupportedPlotCallback(type_name, self._plot_type) self._callbacks.append(cls(*args, **kwargs)) + return self update_wrapper( wrapper=closure,