Question : Overlapping xtick labels pyplot
Answered by :
for i, d in enumerate([360, 30, 7, 1]): ax = axes.flatten()[i] earlycut = now - relativedelta(days=d) data = df.loc[df.index>=earlycut, :] ax.plot(data.index, data['value']) ax.get_xaxis().set_minor_locator(mpl.ticker.AutoMinorLocator()) ax.get_yaxis().set_minor_locator(mpl.ticker.AutoMinorLocator()) ax.grid(b=True, which='major', color='w', linewidth=1.5) ax.grid(b=True, which='minor', color='w', linewidth=0.75) plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right')
fig.tight_layout()
Source : https://stackoverflow.com/questions/26700598/matplotlib-showing-x-tick-labels-overlapping | Last Update : Tue, 24 Aug 21