issues: 291103680
This data as json
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
291103680 | MDU6SXNzdWUyOTExMDM2ODA= | 1852 | bug: 2D pcolormesh plots are wrong when coordinate is not ascending order | 1386642 | closed | 0 | 9 | 2018-01-24T07:01:07Z | 2018-02-18T19:06:31Z | 2018-02-18T19:06:31Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possible```python import matplotlib.pyplot as plt import numpy as np import xarray as xr x = np.arange(10) y = np.arange(20) np.random.shuffle(x) x = xr.DataArray(x, dims=['x'], coords={'x': x}) y = xr.DataArray(y, dims=['y'], coords={'y': y}) z = x + y z_sorted = z.isel(x=np.argsort(x.values)) make plotfig, axs= plt.subplots(1, 2, figsize=(6,3)) z_sorted.plot(ax=axs[0]) axs[0].set_title("X is sorted") z.plot(ax=axs[1]) axs[1].set_title("X is not unsorted") plt.tight_layout() ``` Problem descriptionSometime the coordinates in an xarray dataset are not always sorted in ascending order. I recently had an issue where the time coordinate of a 2D datasets was scrambled, so calling Expected OutputHere is the image generated by the snippet above: The left and right panels should be the same. Paste the output here xr.show_versions() here
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Darwin
OS-release: 16.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
xarray: 0.10.0+dev50.ga988dc2
pandas: 0.20.3
numpy: 1.13.1
scipy: 0.19.1
netCDF4: 1.3.1
h5netcdf: 0.5.0
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.15.2
distributed: 1.18.3
matplotlib: 2.0.2
cartopy: None
seaborn: 0.8.0
setuptools: 36.5.0.post20170921
pip: 9.0.1
conda: 4.3.29
pytest: 3.2.1
IPython: 6.1.0
sphinx: 1.6.3
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1852/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |