Mar-01-2022, 03:57 PM
This is much better:
The dates also line up with the data, now, and it plots through the last date in the dataframe.
datetimes = pd.to_datetime(btstats['Date']) btstats['Date'] = datetimes fig, ax = plt.subplots() ax.plot(btstats['Date'], btstats['Cum.PnL']) ax.set_xlabel('Date') ax.set_ylabel('Cumulative PnL')The 'Date' column was type object. Converting to datetime lets matplotlib automatically scale it and it now prints just every two months, which is fine. I could probably customize that somehow... I'll try and figure that out but if not then this is readable and clean.
The dates also line up with the data, now, and it plots through the last date in the dataframe.