-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
da.plot.pcolormesh fails when there is a datetime coordinate #1661
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
Comments
I'm quite sure it worked in the past, but trying old versions of |
Never mind, this is in matplotlib. See matplotlib/matplotlib#9577. |
Actually, it isn't in matplotlib really. It's xarrays responsibility after all. To plot with pcolormesh, one needs to convert the date axis using datenum, see https://stackoverflow.com/a/27918586/974555 . When plotting with xarray, that is out of control of the user, so there must be some step within xarray to prepare this. What I still don't know is why my code (not this MWE, but my actual code) worked several months ago but not now. |
The problem is triggered by a recent change in pandas. I'm currently bisecting pandas to see where it is but it's a little slow due to the compilation at every step. |
This happens after: pandas-dev/pandas@2310faa |
Pandas used to register a matplotlib converter for datetimes on import. I’ll take a closer look in a bit. |
@TomAugspurger Is it this one? |
Yep, that was the change. The fix is to explicitly register the converters before plotting: from pandas.tseries import converter
converter.register() |
Thanks @gerritholl and @TomAugspurger for your help figuring this out. See #1669 for a fix. |
da.plot.pcolormesh
, whereda
is aDataArray
, fails withTypeError: invalid type promotion
when one of the coordinates is a datetime array:The text was updated successfully, but these errors were encountered: