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
What happened:
Xarray has some assumption what is or is not plottable. Xarray should not do that, and just ask the plotting library, if it actually can.
What you expected to happen:
No additional checking, just plot it.
If something cannot be plotted, matplotlib (or whatever backend is used) will anyway check, and know better.
Minimal Complete Verifiable Example:
importxarrayasxrimportmatplotlib.pyplotaspltda=xr.DataArray(data=[1, 2], coords={"x": ["abc", "cde"]}, dims="x")
print(da)
try:
da.plot()
exceptTypeError:
plt.plot(da.x, da)
print("But it is possible")
plt.show()
Anything else we need to know?:
I can submit a PR to remove _ensure_plottable
Environment:
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: fcebe5e
python: 3.9.7 (default, Aug 30 2021, 00:00:00)
[GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]
python-bits: 64
OS: Linux
OS-release: 5.13.12-200.fc34.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.6
libnetcdf: 4.7.3
I think if you try out 0.19 you'll find that this works, see #5464. I just tried your example with master main and it works.
Though I'm not opposed to removing it, it makes sense to me to just trust the backend will do its job. But there's always some weird edge case that doesn't always make it that easy.
I tried it with master, and it failed. Trying with main worked :-D
I think there will be cases where the data is not suitable for plotting, where the new error will be less clear than the old one, but I still think that would be overall an improvement.
What happened:
Xarray has some assumption what is or is not plottable. Xarray should not do that, and just ask the plotting library, if it actually can.
What you expected to happen:
No additional checking, just plot it.
If something cannot be plotted, matplotlib (or whatever backend is used) will anyway check, and know better.
Minimal Complete Verifiable Example:
Anything else we need to know?:
I can submit a PR to remove
_ensure_plottable
Environment:
Output of xr.show_versions()
INSTALLED VERSIONS ------------------ commit: fcebe5e python: 3.9.7 (default, Aug 30 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] python-bits: 64 OS: Linux OS-release: 5.13.12-200.fc34.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.3xarray: 0.18.2
pandas: 1.2.5
numpy: 1.20.1
scipy: 1.6.2
netCDF4: 1.5.5.1
pydap: None
h5netcdf: None
h5py: 3.1.0
Nio: None
zarr: None
cftime: 1.4.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 2021.08.1
distributed: None
matplotlib: 3.4.3
cartopy: None
seaborn: None
numbagg: None
pint: 0.16.1
setuptools: 54.2.0
pip: 21.0.1
conda: None
pytest: 6.2.2
IPython: 7.20.0
sphinx: 3.4.3
The text was updated successfully, but these errors were encountered: