I have a pandas DataFrame with two columns: month_of_sale
which is a date, and number_of_gizmos_sold
which is a number.
I'm trying to increase the frequency of the labels on the x-axis so it's easier to read, but I can't!
Here is the df.head()
of my table:
and this is what it plots:
df.plot(y='number_of_gizmos_sold', figsize=(15,5))
I'd like to increase the frequency of the labels, because there's a big space in between them.
What I've tried
plot.xaxis.set_major_locator(MonthLocator())
but that seems to increase the distance between the labels even more.
plot.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
Strangely, I end up with this:
The questions that last plot raises for me are:
- What's up with 0002 as the year?
- And why do I still have the old
Jul
labels there too?