Repository: scipp/plopp

Issue:
Strange and broken behaviour with log norm
Given
```python
import scipp as sc
import plopp as pp
%matplotlib widget
da = sc.DataArray(sc.arange('x', 1, 101).fold('x', sizes={'x': 10, 'y': 10}))
```
I get a bunch of strange results with log norms.

`pp.plot(da, norm="log")` raises `ValueError: Invalid vmin or vmax` from mpl's colorbar.

`pp.plot(da, vmin=1, vmax=100, norm="log")` warns:
```
site-packages/numpy/core/fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce
  return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
```

I also have some more complicated data where `da.plot(log='norm')` raises `AttributeError: QuadMesh.set() got an unexpected keyword argument 'log'`. (With and without vmin and vmax) But I can't seem to reproduce it with other data.

Note that in the first 2 cases, clicking the 'log' button shows the corresponding error/warning in the Jupyter log console. But in the third case, it shows nothing. But the plot also doesn't change when clicking the button.

Discussion:

Patch:
diff --git a/src/plopp/core/limits.py b/src/plopp/core/limits.py
index ec7627f..b3dc3d0 100644
--- a/src/plopp/core/limits.py
+++ b/src/plopp/core/limits.py
@@ -19,7 +19,8 @@ def find_limits(x: Variable,
         raise ValueError("No finite values were found in array. Cannot compute limits.")
     finite_vals = v[finite_inds]
     if scale == "log":
-        finite_min = np.amin(finite_vals, initial=np.inf, where=finite_vals > 0)
+        initial = (np.finfo if v.dtype.kind == 'f' else np.iinfo)(v.dtype).max
+        finite_min = np.amin(finite_vals, initial=initial, where=finite_vals > 0)
     else:
         finite_min = np.amin(finite_vals)
     finite_max = np.amax(finite_vals)


Test patch:
diff --git a/tests/core/limits_test.py b/tests/core/limits_test.py
index 7d76bd2..3e32f18 100644
--- a/tests/core/limits_test.py
+++ b/tests/core/limits_test.py
@@ -22,6 +22,13 @@ def test_find_limits_log():
     assert sc.identical(lims[1], sc.scalar(10., unit='m'))
 
 
+def test_find_limits_log_int():
+    x = sc.arange('x', 11, unit='m')
+    lims = find_limits(x, scale='log')
+    assert sc.identical(lims[0], sc.scalar(1, unit='m'))
+    assert sc.identical(lims[1], sc.scalar(10, unit='m'))
+
+
 def test_find_limits_with_nan():
     x = sc.arange('x', 11., unit='m')
     x.values[5] = np.nan