I have a pandas random number framework where the index is of type dtype='datetime64[ns] . At the end of the question you will find reproducible code.

When I draw this with ax.dfplot() , I get a beautifully formatted x axis as follows:

I would like to make a diagram from this instead, but when I use ax = df.plot(kind = 'bar') , the x axis gets messed up:

How can i change this?
Thanks for any suggestions!
Reproducible code for the input data frame and the first two graphs:
import pandas as pd import numpy as np import matplotlib.dates as mdates
Here is what I have tried so far:
Here is a somewhat similar question, but I am having problems with the playable fragment provided there. Perhaps the problem is with the version, since she is several years old?
I was also able to at least improve the format using the suggestions here :
title = 'Bar' ax = df.plot(title = title, fontsize = 10, kind = 'bar') xtl=[item.get_text()[:10] for item in ax.get_xticklabels()] _=ax.set_xticklabels(xtl)

I had high hopes for suggestions here , as it seemed that at least I could only display months to the mdates.DateFormatter('%d') (using m instead). But I am having problems with the results:
title = 'Bar' ax = df.plot(title = title, fontsize = 10, kind = 'bar') myFmt = mdates.DateFormatter('%d') ax.xaxis.set_major_formatter(myFmt)
I only get this:
