From 70e30cc027799acf5a7db77f4ca3c973e176d04d Mon Sep 17 00:00:00 2001 From: Drew Leonard Date: Wed, 18 Dec 2024 13:54:20 +0000 Subject: [PATCH] Use nanmin/nanmax in case some but not all of the data is nan --- mpl_animators/wcs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpl_animators/wcs.py b/mpl_animators/wcs.py index 3ed2997..f7bd546 100644 --- a/mpl_animators/wcs.py +++ b/mpl_animators/wcs.py @@ -278,8 +278,8 @@ def update_plot_1d(self, val, line, slider): # If we are not setting ylim globally then we set it per frame. if self.ylim == 'dynamic': - vmin = float(self.data[self.frame_index].min()).compute() - vmax = float(self.data[self.frame_index].max()).compute() + vmin = float(np.nanmin(self.data[self.frame_index])) + vmax = float(np.nanmax(self.data[self.frame_index])) if np.isnan(vmin) or np.isnan(vmax): warnings.warn(UserWarning(f"No data found for data slice {self.frame_index} - cannot set ylim")) return