[plotter] fix norm

This commit is contained in:
Noe Brucy
2021-07-05 23:34:15 +02:00
parent a50fb60663
commit d2b950c215
+10 -7
View File
@@ -546,8 +546,9 @@ class Plotter(Aggregator, BaseProcessor):
cmap="plasma",
norm="log",
put_cbar=True,
autoscale=True,
transform=None,
vmin=None,
vmax=None,
**kwargs,
):
"""
@@ -579,13 +580,15 @@ class Plotter(Aggregator, BaseProcessor):
if transform is not None:
dmap = transform(dmap)
if norm == "log":
norm = mpl.colors.LogNorm()
elif norm == "linear":
norm = mpl.colors.NoNorm()
if vmin is None:
vmin = np.min(dmap)
if vmax is None:
vmax = np.max(dmap)
if autoscale and norm is not None:
norm.autoscale(dmap)
if norm == "log":
norm = mpl.colors.LogNorm(vmin=vmin, vmax=vmax)
elif norm == "linear":
norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax)
im = plt.imshow(
dmap, extent=im_extent, origin="lower", norm=norm, cmap=cmap, **kwargs