-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Use x and y parameters for Image trace in imshow (for RGB or binary_string=True) #2761
Conversation
What does the output look like if you try this with an xarray with dates? |
or should we raise in that case instead of trying to render? |
@emmanuelle bump on my last comment :) |
@nicolaskruchten looks like I'll look into accepting only numerical types for |
thanks! I think the dates are just ignored and the axis just counts pixels actually... not all that graceful :( |
dx = x[1] - x[0] | ||
else: | ||
raise ValueError( | ||
"Only numerical values are accepted for the `x` parameter " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is correct but I think a bit opaque for users? in the xarray case they've maybe not specified x
(as it's implicit) and they don't know they're using an Image
trace (all they know is they set binary_string=True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I can think of a better error message, but do we agree that we should also error when x
is passed explicitly and does not have a numerical dtype? (otherwise it would just be ignored, which I agree is not a good thing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the error message, is it better now?
LGTM! 💃 |
Closes #2758
I could only get it to work for numerical data types, I don't think the
x0
anddx
parameters ofgo.Image
are meant to work with str or datetime types (could you please confirm @antoinerg?)For example for the
![image](https://user-images.githubusercontent.com/263366/92730940-bfeda580-f374-11ea-8438-6719b36c8b82.png)
airtemps
dataset used in the imshow tutorial, this now works