html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/4409#issuecomment-691146816,https://api.github.com/repos/pydata/xarray/issues/4409,691146816,MDEyOklzc3VlQ29tbWVudDY5MTE0NjgxNg==,15570875,2020-09-11T15:00:01Z,2020-09-11T15:00:01Z,NONE,"I disagree that this is deterministic. If I run the script multiple times, the plot title varies, and I consider the plot title part of the output.
I have jupyter notebooks that create figures and use this code idiom. If I refactor code of mine that is used by these notebooks, I would like to rerun the notebooks to confirm that the notebook results don't change. Having the plot titles change at random complicates this comparison.
I think sorting the coordinates would avoid this difficulty that I encounter.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,694448177
https://github.com/pydata/xarray/pull/4409#issuecomment-691120654,https://api.github.com/repos/pydata/xarray/issues/4409,691120654,MDEyOklzc3VlQ29tbWVudDY5MTEyMDY1NA==,15570875,2020-09-11T14:15:42Z,2020-09-11T14:15:42Z,NONE,"Here's another example that yields non-deterministic coordinate order, which propagates into a plot title when selection is done on the coordinates. When I run the code below, the title is sometimes `x = 0.0, y = 0.0` and sometimes `y = 0.0, x = 0.0`.
This is in a new conda environment that I created using the command `conda create -n title_order python=3.7 matplotlib xarray`. Output from `xr.show_versions()` is below.
I think the non-determinism is coming from the command `ds_subset = ds[['var']]`.
```
import numpy as np
import xarray as xr
xlen = 3
ylen = 4
zlen = 5
x = xr.DataArray(np.linspace(0.0, 1.0, xlen), dims=('x'))
y = xr.DataArray(np.linspace(0.0, 1.0, ylen), dims=('y'))
z = xr.DataArray(np.linspace(0.0, 1.0, zlen), dims=('z'))
vals = np.arange(xlen*ylen*zlen, dtype='float64').reshape((xlen, ylen, zlen))
da = xr.DataArray(vals, dims=('x', 'y', 'z'), coords={'x': x, 'y': y, 'z': z})
ds = xr.Dataset({'var': da})
print('coords for var in original Dataset')
print(ds['var'].coords)
print('**********')
ds_subset = ds[['var']]
print('coords for var after subsetting')
print(ds_subset['var'].coords)
print('**********')
p = ds_subset['var'].isel(x=0,y=0).plot()
print('title for plot() with dim selection')
print(p[0].axes.get_title())
```
Output of xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:25:08)
[GCC 7.5.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1127.13.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: None
libnetcdf: None
xarray: 0.16.0
pandas: 1.1.2
numpy: 1.19.1
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.3.1
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20200814
pip: 20.2.3
conda: None
pytest: None
IPython: None
sphinx: None
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,694448177