Skip to content

guess the second coordinate when only one is passed to pcolormesh() #1290

@vnoel

Description

@vnoel

Say I have a DataArray z with dimensions ('x', 'y'), in that order. If I call z.plot(), it will create a pcolormesh with x the vertical dimension and y the horizontal one. If I want to invert the axes, I need to call z.plot(x='x', y='y'). If I supply only one of the dimensions, i.e. z.plot(x='x'), I get the error message

ValueError: cannot supply only one of x and y

I think that when calling the plot function on a 2d DataArray and passing only one coordinate, as in z.plot(x='x'), xarray could guess we want the unpassed coordinate to be the other one. I don't see why this would be unsafe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions