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/issues/1852#issuecomment-360284982,https://api.github.com/repos/pydata/xarray/issues/1852,360284982,MDEyOklzc3VlQ29tbWVudDM2MDI4NDk4Mg==,10050469,2018-01-24T21:48:41Z,2018-01-24T21:48:41Z,MEMBER,"> Rather than automatically sorting data, we could start raising an error if labels are unsorted.

yes, I prefer that too.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360284640,https://api.github.com/repos/pydata/xarray/issues/1852,360284640,MDEyOklzc3VlQ29tbWVudDM2MDI4NDY0MA==,1217238,2018-01-24T21:47:22Z,2018-01-24T21:47:22Z,MEMBER,"One indication that something is broken here is that `z.plot.imshow()` and `z.plot.pcolormesh()` show very different figures. (`imshow` shows the right data, but the labels on the x-axis are wrong.)

I can see use cases for plotting scrambled data, but for those cases I would probably defer to `seaborn.heatmap()` which does the right thing (including labels):
```
import seaborn
z.to_pandas().pipe(seaborn.heatmap, cmap='viridis')
```
![download 46](https://user-images.githubusercontent.com/1217238/35358810-be1152dc-010c-11e8-8b97-2d1e375890f8.png)

Rather than automatically sorting data, we could start raising an error if labels are unsorted. The error message could suggest either sorting the data with the `sortby()` method or using `seaborn.heatmap`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360284536,https://api.github.com/repos/pydata/xarray/issues/1852,360284536,MDEyOklzc3VlQ29tbWVudDM2MDI4NDUzNg==,10050469,2018-01-24T21:46:58Z,2018-01-24T21:46:58Z,MEMBER,"> I agree that pcolormesh ultimately works with the mesh corners, I am pretty sure passing coordinates of the same length also works.

Passing N coordinates will crop the data of one pixel and plot N-1 pixels. For example:

```python
import matplotlib.pyplot as plt

data = [[1, 2], [3, 4]]
f, (ax1, ax2) = plt.subplots(1, 2)
ax1.pcolormesh([1, 2, 3], [2, 3, 4], data)
ax1.set_title('N+1 coords')
ax2.pcolormesh([1, 2], [2, 3], data)
ax2.set_title('N coords')
plt.savefig('example.png')
```
![example](https://user-images.githubusercontent.com/10050469/35358897-7ab95f42-0158-11e8-9988-996eb2b31228.png)
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360282925,https://api.github.com/repos/pydata/xarray/issues/1852,360282925,MDEyOklzc3VlQ29tbWVudDM2MDI4MjkyNQ==,10050469,2018-01-24T21:41:23Z,2018-01-24T21:41:23Z,MEMBER,"... But I guess that you're right, it should be fine to do as you suggest!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360281631,https://api.github.com/repos/pydata/xarray/issues/1852,360281631,MDEyOklzc3VlQ29tbWVudDM2MDI4MTYzMQ==,10050469,2018-01-24T21:36:42Z,2018-01-24T21:36:42Z,MEMBER,">  Is there some the problem with just adding something like the two lines a wrote above to plot.pcolormesh?

Performance I guess, and the fact that monotonically descending coordinates also work fine. I don't think this happens very often so sorting and calling ``isel`` on every single array is overkill.

I don't have a strong opinion here, so I'll let @shoyer or others decide what's best. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360232940,https://api.github.com/repos/pydata/xarray/issues/1852,360232940,MDEyOklzc3VlQ29tbWVudDM2MDIzMjk0MA==,1386642,2018-01-24T18:42:58Z,2018-01-24T18:42:58Z,CONTRIBUTOR,I think automatically sorting is OK for 1D coordinates at least. I agree it is more complicated for other situations.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360230869,https://api.github.com/repos/pydata/xarray/issues/1852,360230869,MDEyOklzc3VlQ29tbWVudDM2MDIzMDg2OQ==,1386642,2018-01-24T18:36:12Z,2018-01-24T18:36:19Z,CONTRIBUTOR,"> pcolormesh expects n+1 coordinates

I agree that pcolormesh ultimately works with the mesh corners, but I am pretty sure passing coordinates of the same length also works.

> you'll probably have to sort the values beforehand too

True. But we can do it automatically with xarray because it has the coordinate information.

> So the question is how much sanity check xarray should do before sending the data to matplotlib, and maybe a warning of some kind would be useful.

I am not sure there there is any circumstance where it would be preferable to plot the scrambled data. Is there some the problem with just adding something like the two lines a wrote above to `plot.pcolormesh`?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360146186,https://api.github.com/repos/pydata/xarray/issues/1852,360146186,MDEyOklzc3VlQ29tbWVudDM2MDE0NjE4Ng==,10050469,2018-01-24T14:07:16Z,2018-01-24T14:07:16Z,MEMBER,"It's not a trivial problem, because pcolormesh expects n+1 coordinates (the coordinates of the mesh corners), and to do what you want with matplotlib's pcolormesh alone (i.e. without xarray), you'll probably have to sort the values beforehand too (correct me if I'm wrong).

So the question is how much sanity check xarray should do before sending the data to matplotlib, and maybe a warning of some kind would be useful. Xarray's pcolormeh already implements some logic to make it easier to use than matplotlib's (see e.g. https://github.com/pydata/xarray/pull/1079).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680
https://github.com/pydata/xarray/issues/1852#issuecomment-360039440,https://api.github.com/repos/pydata/xarray/issues/1852,360039440,MDEyOklzc3VlQ29tbWVudDM2MDAzOTQ0MA==,1386642,2018-01-24T07:03:00Z,2018-01-24T07:03:12Z,CONTRIBUTOR,"This is pretty easily fixed running 
```python
sort_inds = {dim: np.argsort(z[dim].values) for dim in z.dims}
z = z.isel(**sort_inds)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,291103680