I have a dataframe with a column 'Date' and a column 'Close Price' for the S&P500 from 2010 to 2017. The column date has format YYYY:MM:DD.
I am trying to make a close price vs date graph in matplotlib. The problem is that there are no default x-axis ticks for the date, there is just a black line. I guess the reason is that there are too many dates. Is it possible to make at least a few dates to show? Such as the 1st of each year? Thank you so much for your help in advance!
fig = plt.figure()
ax = plt.axes()
x = df['Date']
y = df['Close']
ax.plot(x,y,label='S&P500')
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, labels)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…