scipp / plopp

Visualization library for scipp
https://scipp.github.io/plopp/
BSD 3-Clause "New" or "Revised" License
7 stars 5 forks source link

Strange and broken behaviour with log norm #172

Closed jl-wynen closed 1 year ago

jl-wynen commented 1 year ago

Given

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.

nvaytet commented 1 year ago

For the third, should it be da.plot(norm='log') instead of da.plot(log='norm') ?