Skip to content
forked from pydata/xarray

Commit

Permalink
Undo the transpose change and add test to make sure transposition is …
Browse files Browse the repository at this point in the history
…right.
  • Loading branch information
dcherian committed Nov 13, 2019
1 parent c9cc698 commit 279ff1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xarray/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def newplotfunc(
dims = yx_dims + tuple(d for d in darray.dims if d not in yx_dims)
if dims != darray.dims:
darray = darray.transpose(*dims, transpose_coords=True)
elif xval.shape[-1] == darray.shape[0]:
elif darray[xlab].dims[-1] == darray.dims[0]:
darray = darray.transpose(transpose_coords=True)

# Pass the data as a masked ndarray too
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2167,4 +2167,4 @@ def test_plot_transposed_nondim_coord(plotfunc):
def test_plot_transposes_properly():
da = xr.DataArray([np.sin(2 * np.pi / 10 * np.arange(10))] * 10, dims=("y", "x"))
hdl = da.plot(x="x", y="y")
np.all(hdl.get_array() == da.to_masked_array().ravel())
assert np.all(hdl.get_array() == da.to_masked_array().ravel())

0 comments on commit 279ff1d

Please sign in to comment.