Skip to content

UxDataArray.plot() should squeeze(), to support extra dimensions with size 1 #1724

Open

Description

@Sevans711

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:

Image

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

Activity

  1. added
    visualization
    extra dims
    on Aug 31, 2026
  2. moved this from 📚 Backlog to 📝 To-Do in UXarray Developmenton Sep 21, 2026
  3. Sevans711 commented on Oct 22, 2026

    @Sevans711
    CollaboratorAuthor

    Actually, after talking through it during internal discussion today, the team decided to instead go with always squeezing away any size 1 non-grid extra dimensions for all plotting methods (at least, for all existing plotting methods). #1812 will include this squeezing for the new contour plots feature). This means that closing this issue will require adding this squeezing to all existing plotting methods, not just to arr.plot().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extra dimsvisualization

Type

No type

Fields

Priority

Low

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions