Skip to content

Commit 279ff1d

Browse files
committed
Undo the transpose change and add test to make sure transposition is right.
1 parent c9cc698 commit 279ff1d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

xarray/plot/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def newplotfunc(
693693
dims = yx_dims + tuple(d for d in darray.dims if d not in yx_dims)
694694
if dims != darray.dims:
695695
darray = darray.transpose(*dims, transpose_coords=True)
696-
elif xval.shape[-1] == darray.shape[0]:
696+
elif darray[xlab].dims[-1] == darray.dims[0]:
697697
darray = darray.transpose(transpose_coords=True)
698698

699699
# Pass the data as a masked ndarray too

xarray/tests/test_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,4 +2167,4 @@ def test_plot_transposed_nondim_coord(plotfunc):
21672167
def test_plot_transposes_properly():
21682168
da = xr.DataArray([np.sin(2 * np.pi / 10 * np.arange(10))] * 10, dims=("y", "x"))
21692169
hdl = da.plot(x="x", y="y")
2170-
np.all(hdl.get_array() == da.to_masked_array().ravel())
2170+
assert np.all(hdl.get_array() == da.to_masked_array().ravel())

0 commit comments

Comments
 (0)