My plot shows on the x-axis the ordinal numbers (from dates) used a good fitting plot. But I want the axis to show dates in the normal format (dd--mm--yyyy) without changing the plot in any way.
Also,
ordinalDates = []
for the whole stock cvs:
dateToNumber = datetime.datetime.toordinal(datetime.date())
ordinalDates.append(dateToNumber)
I have a list having all the converted dates (in ordinal number). and this list is the one I use to fit the linear regression curve as well as plot it.
Convert them to a string in a second list:
dateToNumber = datetime.datetime.toordinal(datetime.date())
ordinalDates.append(dateToNumber)
strDates.append(str(datetime.date()))
And then update the xticklabels
:
plt.set_xticklabels(strDates)