Use x and y parameters for Image trace in imshow (for RGB or binary_string=True)#2761
Use x and y parameters for Image trace in imshow (for RGB or binary_string=True)#2761emmanuelle merged 6 commits intomasterfrom
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.
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.
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.
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
x0anddxparameters ofgo.Imageare meant to work with str or datetime types (could you please confirm @antoinerg?)For example for the

airtempsdataset used in the imshow tutorial, this now works