-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Axes flipped when plotting an xarray.DataArray #668
Comments
Okay solved it myself by passing |
Thanks for the issue!
I'd prefer not to add any special case logic looking for specific coordinate names so definitely -1 on that. However since xarray somehow figures out the appropriate axis ordering in this case we will have to take another look at how they do it compared to how we do it. |
xarray reverses the DataArray dims, it considers the x-axis as dims[1] and and the y-axis as dims[0]. This is defined here: In the example provided by the OP the DataArray dimensions are |
@philippjfr should we reproduce what xarray does, as asked in this issue? |
ALL software version info
hvplot imported as
import hvplot.xarray
Description of expected behavior and the observed behavior
Expected:
Plot created from a 2-dimensional
xarray.DataArray
is by default plotted similarly to xarray's matplotlib wrapper, i.e. same orientation of axes.Observed:
x and y axes are flipped
Complete, minimal, self-contained example code that reproduces the issue
Can't provide a self-contained example but hopefully the following helps.
The
![grafik](https://user-images.githubusercontent.com/56583917/138289164-6dd82d11-3ac6-4bb8-80e2-e0adad9fa1d8.png)
xarray.DataArray
with UTM x and y coordinates:Plot using xarray's matplotlib wrapper showing the correct orientation:
Plots using hvplot (same problem with
.hvplot
and.hvplot.image
) with some flippin' going on:The text was updated successfully, but these errors were encountered: