-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
plotting facet grid with singleton dimension should create a facet grid with size 1 #7552
Comments
This is caused by the xarray/xarray/plot/dataarray_plot.py Line 267 in 4194920
@Illviljan do you know why this is required? I assume you want to remove singleton dimensions to better choose the correct plot method? Maybe we should exclude col, row dims from the squeeze? |
@liorella-qm in the meantime you can use |
See #620 (!)
This seems sensible. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Since I didn't see anyone objecting to the solution provided by @headtr1ck and I also found this behaviour annoying, I hope that nobody minds that I created a PR with it. |
What is your issue?
In my application, I want to plot facet grids of datasets, and the dimension I want to facet sometimes has a length of 1 and sometimes more than 1. When the length of the dimension is > 1, the
plot(col=....)
method ofDataArray
works as expected. However, when it is 1, I get an error and my code fails, although it would have been natrual for the plot method to create aFacetGrid
with length of one facet.As a minimal example, this code:
fails with an error:
This example works as expected:
The text was updated successfully, but these errors were encountered: