Q:

Switching month numbers to month names on x-axis of histogram matplotlib

I have a histogram with data points over one year. Everything works well, except that the month get displayed as a number. I would like to display them with their names. Instead of "01" it should say "January" (also slightly rotated, but I can do that myself.)
How do I tell maplotlib to use the month names?
I already looked in the documentation and other posts, but couldn't make it work.
My code:
fig = plt.figure(figsize=(12,6))
s = fig.add_subplot(111)
s.hist(mydata,bins=120,stacked=True, color=mycolors, alpha=1)
s.xaxis.set_major_locator(mdates.MonthLocator())
s.xaxis.set_major_formatter(mdates.DateFormatter('%m'))
s.legend(legend)

With mydata being a list of dataframes of shape (n,1).
I am new to matplotlib and don't fully understand what is happening in s.xaxis.set_major_formatter(mdates.DateFormatter('%m')) but my guess is this line needs to be modified?
My Code results in the following Graph:

Any help is greatly appreciated :)

A:

Use %B in the DateFormatter to get month names instead of the month numbers that %m gives. You can also use %b to get abbreviated names.

