diff --git a/src/plopp/backends/matplotlib/canvas.py b/src/plopp/backends/matplotlib/canvas.py index 4413f10f..db62c494 100644 --- a/src/plopp/backends/matplotlib/canvas.py +++ b/src/plopp/backends/matplotlib/canvas.py @@ -533,7 +533,7 @@ def logx(self): """ self.xscale = 'log' if self.xscale == 'linear' else 'linear' self._bbox.xmin = np.inf - self._bbox.xmax = np.NINF + self._bbox.xmax = -np.inf self.autoscale() def logy(self): @@ -542,7 +542,7 @@ def logy(self): """ self.yscale = 'log' if self.yscale == 'linear' else 'linear' self._bbox.ymin = np.inf - self._bbox.ymax = np.NINF + self._bbox.ymax = -np.inf self.autoscale() def finalize(self): diff --git a/src/plopp/core/limits.py b/src/plopp/core/limits.py index 0919d45b..f6d50cee 100644 --- a/src/plopp/core/limits.py +++ b/src/plopp/core/limits.py @@ -29,7 +29,7 @@ def find_limits( if x.masks: x = sc.where( merge_masks(x.masks), - sc.scalar(np.NaN, unit=x.unit), + sc.scalar(np.nan, unit=x.unit), x.data.to(dtype='float64'), ) v = x.values diff --git a/src/plopp/graphics/colormapper.py b/src/plopp/graphics/colormapper.py index 96294427..85f83565 100644 --- a/src/plopp/graphics/colormapper.py +++ b/src/plopp/graphics/colormapper.py @@ -110,7 +110,7 @@ def __init__( self.user_vmin = vmin self.user_vmax = vmax self.vmin = np.inf - self.vmax = np.NINF + self.vmax = -np.inf self.norm = norm self._autoscale = autoscale @@ -271,7 +271,7 @@ def toggle_norm(self): self.norm = "log" if self.norm == 'linear' else 'linear' self.normalizer = _get_normalizer(self.norm) self.vmin = np.inf - self.vmax = np.NINF + self.vmax = -np.inf self.autoscale() self._set_normalizer_limits() self._set_artists_colors(self.artists.keys()) diff --git a/tests/core/limits_test.py b/tests/core/limits_test.py index 0d9519ea..c864d456 100644 --- a/tests/core/limits_test.py +++ b/tests/core/limits_test.py @@ -47,7 +47,7 @@ def test_find_limits_with_inf(): def test_find_limits_with_ninf(): da = sc.DataArray(data=sc.arange('x', 11.0, unit='m')) - da.values[5] = np.NINF + da.values[5] = -np.inf lims = find_limits(da) assert sc.identical(lims[0], sc.scalar(0.0, unit='m')) assert sc.identical(lims[1], sc.scalar(10.0, unit='m')) @@ -55,7 +55,7 @@ def test_find_limits_with_ninf(): def test_find_limits_no_finite_values_raises(): da = sc.DataArray( - data=sc.array(dims=['x'], values=[np.nan, np.inf, np.NINF, np.nan], unit='m') + data=sc.array(dims=['x'], values=[np.nan, np.inf, -np.inf, np.nan], unit='m') ) with pytest.raises(ValueError, match="No finite values were found in array"): _ = find_limits(da)