0

I am new to python. I am plotting the Bit error rate data w.r.t time and i want to remove these zeros. My x-axis values are like this hh:mm:ss:ffffff. I want to remove the seconds and microseconds as, it is occupying a lot of place on the graph/plot and they are overlapping on each other. How can i remove the seconds and microseconds (ss::ffffff) from x ticks? and plot only hours and minutes and remove the seconds and microseconds. Is it possible?

1 Answers1

1

You can do this using the MinuteLocator tick locator and a custom formatter (see also this answer)

import matplotlib.dates as mdates

ax.xaxis.set_major_locator(mdates.MinuteLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
Community
  • 1
  • 1
tmdavison
  • 64,360
  • 12
  • 187
  • 165