Closed scottstanie closed 2 years ago
Does it seem like there's another workaround for using masked_invalid
?
https://numpy.org/doc/stable/reference/generated/numpy.ma.masked_invalid.html this says
Only applies to arrays with a dtype where NaNs or infs make sense (i.e. floating point types), but accepts any array_like object.
This is kinda annoying behavior from numpy IMO.... I'll point out that the workaround I've got now is to do
ax.plot(s.index, s['col'])
indead of
s['col'].plot(ax=ax)
It's not a big deal for me, so if you think this would be too many annoying changes to make for proplot, feel free to close this.
Thanks for the report, this is now fixed (54acfb1). Also used your example to discover + fix an issue with auto-axis reversal that cropped up since version 0.9.5 (f9ac77f4).
import proplot as pplt
import pandas as pd
import numpy as np
fig, ax = pplt.subplots()
dates = pd.date_range(start='20200101', end='20200105')
s = pd.DataFrame(data={'col': np.arange(5)}, index=dates)
s['col'].plot(ax=ax)
Description
Plotting a pandas dataframe using a proplot axis fails when the index is a
DatetimeIndex
Steps to reproduce
Actual behavior:
Full traceback:
Possibly because it's converting to a 2D array of Periods:
Equivalent steps in matplotlib
Using
does work.
Proplot version