Skip to content

Commit 0226d4c

Browse files
committed
Check that user didn't repeat a dimension name
1 parent 1b3f342 commit 0226d4c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

xarray/plot/utils.py

+3
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ def _infer_xy_labels_3d(darray, x, y, rgb):
261261
Attempts to infer which dimension is RGB/RGBA by size and order of dims.
262262
263263
"""
264+
assert rgb is None or rgb != x
265+
assert rgb is None or rgb != y
264266
# Start by detecting and reporting invalid combinations of arguments
265267
assert darray.ndim == 3
266268
not_none = [a for a in (x, y, rgb) if a is not None]
@@ -306,6 +308,7 @@ def _infer_xy_labels(darray, x, y, imshow=False, rgb=None):
306308
307309
darray must be a 2 dimensional data array, or 3d for imshow only.
308310
"""
311+
assert x is None or x != y
309312
if imshow and darray.ndim == 3:
310313
return _infer_xy_labels_3d(darray, x, y, rgb)
311314

0 commit comments

Comments
 (0)