Skip to content

Don't squeeze DataArray before plotting #620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jhamman opened this issue Oct 10, 2015 · 5 comments
Open

Don't squeeze DataArray before plotting #620

jhamman opened this issue Oct 10, 2015 · 5 comments

Comments

@jhamman
Copy link
Member

jhamman commented Oct 10, 2015

As was discussed in #608, we should honor the shape of the DataArray when selecting plot methods. Currently, we're squeezing the DataArray before plotting. This ends up plotting a line plot for a DataArray with shape (N, 1). We should find a way to plot a pcolormesh or imshow plot in this case. The trick will be figuring out what to do in _infer_interval_breaks.

@shoyer
Copy link
Member

shoyer commented Oct 10, 2015

I see two options:

  1. Squeeze after the row/col selection logic.
  2. Raise an error if someone attempts to plot a (N, 1) plot as 2D.

1 might actually be preferable to not squeezing at all.

@stale
Copy link

stale bot commented Jan 31, 2019

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here; otherwise it will be marked as closed automatically

@dschneiderch
Copy link

I already mentioned this issue in a couple others but, as an FYI, I ran into this trying to write a plotting function that accepts a dataarray and **kwargs. It's a bit annoying to have to deal with the dataarray differently depending on whether the facetting variable has length == 1 or >1.

@shoyer
Copy link
Member

shoyer commented Jul 16, 2021

I would support a breaking change to Xarray's plotting methods here to remove squeezing. These sort of inconsistencies are really indeed annoying to program around!

@headtr1ck
Copy link
Collaborator

headtr1ck commented Apr 8, 2023

Reviving this ancient issue here.
We could add a deprecation cycle and issue a warning for dimensions with size 1.

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

No branches or pull requests

4 participants