I’m plotting line graphs in Python Matplotlib of times which I get in mm:ss.tttt format.
I’ve already converted the values back to 10thousanths of a second and I can create a nice plot. But that means the Y axis show a value of “832323” instead of easier to read “1:23.2323”.
Is there some way I can format the output values appropriately?
I worked this out myself shortly after I wrote this. Use Matplotlibs’s axis, set_major_formatter() function.
I wrote a quick formatting function that would take a value in 10-thousandths of a second and turn it back into mm:ss.tttt. And then passed this formatter to the axis definition.
Import the ‘ticker’ module along with the plotting stuff:
Create your own value formatting function:
Then in my plot code I did this to alter the Y axis formatting: