[Matplotlib-users] Controlling the number of displayed digits in time axis labels

William Ray Wing wrw at mac.com
Mon Nov 7 22:30:56 EST 2016


I need to plot some time series data in which the time axis is specified by numpy/pandas 64-bit date-time values.  I’m only interested in hours, minutes, and seconds, and the seconds value is only accurate to hundredths.  I’m formatting the time axis as:

x_format = mathplotlib.dates.DateFormatter('%H:%M:%S’)

which gives me hours, minutes, and seconds, BUT gives me six digits of bogus precision after the seconds decimal point.  Is there any way to truncate those six digits to three.  I’ve tried several Google searches, but have been unsuccessful in coming up with anything.

Thanks,
Bill


More information about the Matplotlib-users mailing list