Hi first question in stack overflow. So any advice is welcomed. I am trying to set my plot to show all x labels (which is months) in my plot however plot automatically ignore the some of the x labels by showing [2018-07, 2019-01, 2019-07...].
FYI: My date variable is a panda series list of months e.g. [2018-07, 2018-08, 2018-09...] which I wish to show all x labels in the plot. I had tried ax1.set_xticks(x_indexes), ax1.set_xticklabels(date) putting in both AX1 and AX2 plots but either way does not work.
fig, ax1 = plt.subplots()
fig.tight_layout()
x_indexes = np.arange(len(date))
AX1 Layout
color1 = 'darkgreen'
ax1.plot(date, net_worth,
color = color1,
linestyle = "-")
ax1.set_ylabel("Net Worth", color = color1, loc = 'bottom')
ax1.tick_params(axis = 'y', labelcolor = color1)
ax1.set_xticks(x_indexes)
ax1.set_xlabels(date)
AX2 Layout
ax2 = ax1.twinx()
color2 = 'darkgoldenrod'
ax2.plot(date, mental_health,
color = color2,
linestyle = '--',
marker = '*')
ax2.set_ylabel("Average Mental Health past four weeks", color = color2, loc = 'top')
ax2.tick_params(axis = 'y', labelcolor = color2)
Putting ax1.set_xticks(x_indexes), ax1.set_xticklabels(date) in AX1