To follow xarray behavior, UxDataArray.plot() should call squeeze() automatically, while calling specific plotting methods like UxDataArray.plot.polygons() should not.
Checking help(xr.DataArray.plot) clarifies: Calls xarray plotting function based on the dimensions of the squeezed DataArray.
Here is a simple demonstration:
Above, (A) and (D) are equivalent; x.plot() dispatches to x.plot.line() because x is 1D. Meanwhile, (B) and (C) are equivalent as per the clarification above; thing.plot() is equivalent to thing.squeeze().plot(). Finally, (E) shows that calling a specific method directly does not automatically apply squeeze().
See discussion in #1461 for more details
To follow xarray behavior,
UxDataArray.plot()should call squeeze() automatically, while calling specific plotting methods likeUxDataArray.plot.polygons()should not.Checking
help(xr.DataArray.plot)clarifies:Calls xarray plotting function based on the dimensions of the squeezed DataArray.Here is a simple demonstration:
Above, (A) and (D) are equivalent;
x.plot()dispatches tox.plot.line()becausexis 1D. Meanwhile, (B) and (C) are equivalent as per the clarification above;thing.plot()is equivalent tothing.squeeze().plot(). Finally, (E) shows that calling a specific method directly does not automatically apply squeeze().See discussion in #1461 for more details