From 39b3ad0ba8c24f595c6ff531077496d77f9b6ade Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Thu, 9 Jan 2025 13:29:31 -0600 Subject: [PATCH] fix swap_axes bug wih CellEdgesCallback --- yt/visualization/plot_modifications.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yt/visualization/plot_modifications.py b/yt/visualization/plot_modifications.py index 0e658776a3..45b4cf8dc4 100644 --- a/yt/visualization/plot_modifications.py +++ b/yt/visualization/plot_modifications.py @@ -3394,6 +3394,12 @@ def __call__(self, plot): extent = self._plot_bounds(plot) if plot._swap_axes: im_buffer = im_buffer.transpose((1, 0, 2)) + # note: when using imshow, the extent keyword argument has to be the + # swapped extents, so the extent is swapped here (rather than + # calling self._set_plot_limits). + # https://github.com/yt-project/yt/issues/5094 + extent = _swap_axes_extents(extent) + plot._axes.imshow( im_buffer, origin="lower", @@ -3401,4 +3407,3 @@ def __call__(self, plot): extent=extent, alpha=self.alpha, ) - self._set_plot_limits(plot, extent)