id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 686461572,MDU6SXNzdWU2ODY0NjE1NzI=,4378,Plotting when Interval coordinate is timedelta-based,500246,open,0,,,2,2020-08-26T16:36:27Z,2022-04-18T21:55:15Z,,CONTRIBUTOR,,,," **Is your feature request related to a problem? Please describe.** The xarray plotting interface supports coordinates containing `pandas.Interval` iff those intervals contain numbers. It fails when those intervals contain `pandas.Timedelta`: ```python import numpy as np import pandas as pd import xarray as xr da = xr.DataArray( np.arange(10), dims=(""x"",), coords={""x"": [pd.Interval(i, i+1) for i in range(10)]}) da.plot() # works da = xr.DataArray( np.arange(10), dims=(""x"",), coords={""x"": [pd.Interval( d-pd.Timestamp(""2000-01-01""), d-pd.Timestamp(""2000-01-01"")+pd.Timedelta(""1H"")) for d in pd.date_range(""2000-01-01"", ""2000-01-02"", 10)]}) da.plot() # fails ``` The latter fails with: ``` Traceback (most recent call last): File ""mwe82.py"", line 18, in da.plot() # fails File ""/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/plot/plot.py"", line 446, in __call__ return plot(self._da, **kwargs) File ""/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/plot/plot.py"", line 200, in plot return plotfunc(darray, **kwargs) File ""/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/plot/plot.py"", line 302, in line _ensure_plottable(xplt_val, yplt_val) File ""/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/plot/utils.py"", line 551, in _ensure_plottable raise TypeError( TypeError: Plotting requires coordinates to be numeric or dates of type np.datetime64, datetime.datetime, cftime.datetime or pd.Interval. ``` This error message is somewhat confusing, because the coordinates _are_ ""dates of type (...) pd.Interval"", but perhaps a timedelta is not considered a date. **Describe the solution you'd like** I would like that I can use the xarray plotting interface for any pandas.Interval coordinate, including `pandas.Timestamp` and `pandas.Timedelta`. **Describe alternatives you've considered** I'll ""manually"" calculate the midpoints and use those as a timedelta coordinate instead. **Additional context** It seems that regular timedeltas aren't really supported either, although they don't cause an error message, they rather produce [incorrect results](https://stackoverflow.com/q/50717534). There's probably a related issue somewhere, but I can't find it now.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4378/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 203630267,MDU6SXNzdWUyMDM2MzAyNjc=,1234,`where` grows new dimensions for unrelated variables,500246,open,0,,,5,2017-01-27T13:02:34Z,2022-04-18T16:04:16Z,,CONTRIBUTOR,,,,"In the example below, the dimensionality for data variable `y` grows from `(b)` to `(b, a)` after calling the dataset `where` method. This behaviour does not appear to be documented. Is it a bug? ``` In [46]: ds = xarray.Dataset({""x"": ((""a"", ""b""), arange(25).reshape(5,5)+100), ""y"": (""b"", arange(5)-100)}, {""a"": arange(5), ""b"": arange(5)*2, ""c"": ((""a"",), list(""ABCDE""))}) In [47]: print(ds) Dimensions: (a: 5, b: 5) Coordinates: * b (b) int64 0 2 4 6 8 c (a) ='A') & (ds.c<='C')) Out[69]: Dimensions: (a: 5, b: 5) Coordinates: * b (b) int64 0 2 4 6 8 c (a)