issues: 292054887
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 292054887 | MDU6SXNzdWUyOTIwNTQ4ODc= | 1862 | Weird looking plots from combined DataArrays | 244887 | closed | 0 | 5 | 2018-01-26T22:48:04Z | 2019-01-22T22:48:54Z | 2019-01-22T22:48:54Z | CONTRIBUTOR | I am trying to figure out how to plot 2 dimensional data from multiple data arrays that share common coordinates. My first guess was to throw the data arrays into a dataset and call a plot method, but it seems that is unsupported (perhaps with good reason). My second idea was to trying to "merge" the data arrays into a single one and then call the plot method. Here is what I get: ```python N = 2**6 x, y = range(N), range(N) n = int(N/4) A, B = np.random.rand(n,n), np.random.rand(n,n) xrA = xr.DataArray(A, dims=('x','y'), coords={'x':x[:n],'y':y[:n]}) xrB = xr.DataArray(B, dims=('x','y'), coords={'x':x[-n:],'y':y[-n:]}) xrAB = xrA.combine_first(xrB) dataarrays = [xrA,xrB,xrAB] fig,axs = plt.subplots(1,3,figsize=(15,4)) for ax,data in zip(axs,dataarrays): data.plot(ax=ax) ```
I was not expecting to see the funny looking artifacts extending from the edges of the region with non nan data. A slightly more elaborate version with three non nan regions shows similar behavior: ``` xrC = xr.DataArray(C, dims=('x','y'), coords={'x':x[15:n+15],'y':y[-n-10:-10]}) xrABC = xrA.combine_first(xrB).combine_first(xrC) fig,ax = plt.subplots(figsize=(5,5)) xrABC.plot(ax=ax) ```
Is this a bug or a feature? If not a bug, how should I go about plotting my array data so that nan regions look as such? Output of
|
{
"url": "https://api.github.com/repos/pydata/xarray/issues/1862/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
completed | 13221727 | issue |

