Home > front end >  Problem formatting datetime on matplotlib axis to get just hour and minutes
Problem formatting datetime on matplotlib axis to get just hour and minutes

Time:09-17

This is my current simple plot:

enter image description here

As we can see, the ax y is very badly formatted. The time scale on the axis varies only in hour and minutes, hence, I would like to display only the hour and the minutes.

I am trying to use the mdates.DateFormatter as following:

axs.yaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))

but it does not work. This is the outcome:

enter image description here

I think that I am using the right markers '%H:%M'.

Why is it not working?

EDIT:

This is a small reproductible code. The solutions suggested on enter image description here

  • Related