I'm trying to change my date time format to dd-mm or mm-dd but I'm not sure how to do it. I've looked at other stack overflow questions and answers but I think I may have done my plot a little differently to them as I am computing the sum for each of the different days.
data = {'date': ['2020-09-01', '2020-09-02', '2020-09-03', '2020-09-04', '2020-09-01'],
'newcases': [1, 2, 4, 7, 10]}
df = pd.DataFrame(data, columns = ['date','newcases'])
df['date'] = pd.to_datetime(df['date']) #converted to datetime
import matplotlib.dates as mdates
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%d-%m'))
df.groupby('date').newcases.sum().plot(kind = 'bar')
This is what I have tried but I am not able to format the x-ticks into the right format (dd-mm). It still looks like this:

