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/4061#issuecomment-1464035444,https://api.github.com/repos/pydata/xarray/issues/4061,1464035444,IC_kwDOAMm_X85XQ2h0,60435591,2023-03-10T16:10:44Z,2023-03-10T16:10:44Z,CONTRIBUTOR,"@rjp23 with the latest update to the PR (thanks to @jklymak), your example code produced identical figures without changing it.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,618141254
https://github.com/pydata/xarray/issues/4061#issuecomment-1456434882,https://api.github.com/repos/pydata/xarray/issues/4061,1456434882,IC_kwDOAMm_X85Wz27C,60435591,2023-03-06T16:16:31Z,2023-03-06T16:16:31Z,CONTRIBUTOR,@rjp23: could you close the issue if this indeed resolves your problem?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,618141254
https://github.com/pydata/xarray/issues/4061#issuecomment-1446096001,https://api.github.com/repos/pydata/xarray/issues/4061,1446096001,IC_kwDOAMm_X85WMayB,60435591,2023-02-27T10:43:51Z,2023-02-27T11:16:59Z,CONTRIBUTOR,"As suggested by https://github.com/pydata/xarray/pull/7553#discussion_r1117264787, pass `levels=bounds` instead of `norm=norm` to `data.plot()`. Your example code results in a plot as expected. Would this solve your issue?
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import xarray
#example from https://matplotlib.org/3.1.1/tutorials/colors/colormapnorms.html
#for colormap normalisation
N = 100
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
fig, ax = plt.subplots(2, 1, figsize=(8, 8))
ax = ax.flatten()
bounds = np.linspace(-1, 1, 10)
norm = colors.BoundaryNorm(boundaries=bounds, ncolors=256)
ax[0].pcolormesh(X, Y, Z, norm=norm, cmap='RdBu_r')
#now add data into dataset and plot it using same normalisation
data = xarray.DataArray(Z, dims=('x', 'y'), coords={'x': X[:,0], 'y': Y[0,:]})
data.plot(ax=ax[1], x='x', y='y', levels=bounds, add_colorbar=False)
```

","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,618141254