You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/home/mowglie/Documents/git/xarray/xarray/plot/utils.py:295: UserWarning: Several dimensions of this array could be colors. Xarray will use the last possible dimension ('dim_2') to match matplotlib.pyplot.imshow. You can pass names of x, y, and/or rgb dimensions to override this guess.
'and/or rgb dimensions to override this guess.' % rgb)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-a0592d3e8758> in <module>()
----> 1 da.plot.imshow()
~/Documents/git/xarray/xarray/plot/plot.py in plotmethod(_PlotMethods_obj, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, colors, center, robust, extend, levels, infer_intervals, subplot_kws, cbar_ax, cbar_kwargs, **kwargs)
679 for arg in ['_PlotMethods_obj', 'newplotfunc', 'kwargs']:
680 del allargs[arg]
--> 681 return newplotfunc(**allargs)
682
683 # Add to class _PlotMethods
~/Documents/git/xarray/xarray/plot/plot.py in newplotfunc(darray, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, center, robust, extend, levels, infer_intervals, colors, subplot_kws, cbar_ax, cbar_kwargs, **kwargs)
553 rgb = kwargs.pop('rgb', None)
554 xlab, ylab = _infer_xy_labels(
--> 555 darray=darray, x=x, y=y, imshow=imshow_rgb, rgb=rgb)
556
557 if rgb is not None and plotfunc.__name__ != 'imshow':
~/Documents/git/xarray/xarray/plot/utils.py in _infer_xy_labels(darray, x, y, imshow, rgb)
308 assert x is None or x != y
309 if imshow and darray.ndim == 3:
--> 310 return _infer_xy_labels_3d(darray, x, y, rgb)
311
312 if x is None and y is None:
~/Documents/git/xarray/xarray/plot/utils.py in _infer_xy_labels_3d(darray, x, y, rgb)
297
298 # Finally, we pick out the red slice and delegate to the 2D version:
--> 299 return _infer_xy_labels(darray.isel(**{rgb: 0}).squeeze(), x, y)
300
301
~/Documents/git/xarray/xarray/plot/utils.py in _infer_xy_labels(darray, x, y, imshow, rgb)
312 if x is None and y is None:
313 if darray.ndim != 2:
--> 314 raise ValueError('DataArray must be 2d')
315 y, x = darray.dims
316 elif x is None:
ValueError: DataArray must be 2d
The text was updated successfully, but these errors were encountered:
Ugh, this is literally a one-line fix: I shouldn't have put .squeeze()here. If you also ensure that the dtype is OK (specify uint8, or divide by nine) the example then works.
It's also exactly the kind of thing that Hypothesis would catch for us via #1846. Work (moved to less coding 😢) and the upcoming major release of Hypothesis have priority, but I'll try to find time.
Code Sample, a copy-pastable example if possible
Error log:
The text was updated successfully, but these errors were encountered: