Description
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:
import xarray as xr
import matplotlib.pyplot as plt
da = xr.DataArray(data=[1, 2], coords={"x": ["abc", "cde"]}, dims="x")
print(da)
try:
da.plot()
except TypeError:
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.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