You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Creating colorbar without artist fails with LogNorm #13967
You need to pass in the norm bounds (LogNorm(vmin=..., vmax=...)), otherwise they default to 0..1 -> log(0) -> kaboom (note that unlike "standard" colorbars there's no data to autoscale the norm to).
I don't think this is a bug, but this could be better documented, perhaps.
Ah, but the problem is not on LogNorm's side; it's colorbar() which tries to set the default values (in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colorbar.py#L923).
I actually think it would be fair to say, if the norm is not normalized (so it's not associated to a real mappable with data), then we just throw here.
Requesting the user to do ScalarMappable(Normalize(42, 123)) or ScalarMappable(LogNorm(1, 10)) instead of trying to guess what extents he wants seems fair...
Activity
anntzer commentedon Apr 15, 2019
You need to pass in the norm bounds (LogNorm(vmin=..., vmax=...)), otherwise they default to 0..1 -> log(0) -> kaboom (note that unlike "standard" colorbars there's no data to autoscale the norm to).
I don't think this is a bug, but this could be better documented, perhaps.
dstansby commentedon Apr 15, 2019
Maybe it would be possible to default to say 0.1, 1 for
LogNorminstead?anntzer commentedon Apr 15, 2019
Probably rather 1..10 (10^(0..1)) but other than that, why not.
anntzer commentedon Apr 16, 2019
Ah, but the problem is not on LogNorm's side; it's colorbar() which tries to set the default values (in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/colorbar.py#L923).
I actually think it would be fair to say, if the norm is not normalized (so it's not associated to a real mappable with data), then we just throw here.
Requesting the user to do
ScalarMappable(Normalize(42, 123))orScalarMappable(LogNorm(1, 10))instead of trying to guess what extents he wants seems fair...dstansby commentedon May 6, 2019
I think that's a fair expectation, closing since there is now a more sensible error message.