I have the following code which produces a plot.
labels = sorted(set(df.index))
a = df.loc[df.user_id ==1234, 'count']
b = df.loc[df.user_id ==5678, 'count']
width = 0.5
x = np.arange(len(labels)) # the label locations
fig, ax = plt.subplots(figsize=(10,5))
rects1 = plt.plot_date(x, a, width, label='a')
rects2 = plt.plot_date(x, b, width, label='b', color = 'orange')
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=90)
ax.legend(['a','b'])
plt.ylabel('counts')
fig.tight_layout()
plt.gcf().autofmt_xdate()
plt.show()
The obvious problem is not being able to read the densely packed x labels. Without changing the plot, how can I label by week rather than day?