Skip to content

Commit

Permalink
Use nanmin/nanmax in case some but not all of the data is nan
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarDrew committed Dec 18, 2024
1 parent 8a6dcfd commit 70e30cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mpl_animators/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 70e30cc

Please sign in to comment.