-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Code Sample
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
# prepare array with values between 1e0 and 1e3
da = xr.DataArray(np.logspace(0, 3, 24).reshape(4, 6), dims=('x', 'y'))
# but we want to log-normalize between 1e0 and 1e2
norm = mcolors.LogNorm(1e1, 1e2)
# plot with log norm
da.plot.imshow(norm=norm) # log norm is applied but bounds are replaced
#da.plot.imshow(norm=norm, vmin=norm.vmin, vmax=norm.vmax) # works, but redundant
# show results
plt.show()
Problem description
When passing a norm argument to imshow etc, the norm is forwarded to matplotlib but its data bounds are replaced with those calculated by xarray.
Expected Output
I think that the norm's vmin
and vmax
should take precedence over xarray-generated vmin
and vmax
.
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.15.final.0
python-bits: 64
OS: Linux
OS-release: 4.14.65-1-MANJARO
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: fr_CH.utf8
LOCALE: None.None
xarray: 0.10.8
pandas: 0.23.4
numpy: 1.15.0
scipy: 1.1.0
netCDF4: 1.4.1
h5netcdf: None
h5py: None
Nio: None
zarr: None
bottleneck: None
cyordereddict: None
dask: 0.18.2
distributed: None
matplotlib: 2.2.3
cartopy: 0.15.1
seaborn: None
setuptools: 40.0.0
pip: 18.0
conda: None
pytest: None
IPython: 5.8.0
sphinx: 1.7.6