Axes format/sorting bug

I’m trying to plot a dual Y axis plot with a mm:ss on the Y1 axis.

As you can see in the graph, plotly isn’t sorting the hh:mm:ss values correctly.

If i leave the data as “seconds”, it will display fine.

If I convert seconds to a python timedelta and put into the list as a str and format as a date on the axis, I get this bizarre result. 1:49 gets sorted as the lowest value instead of where it belongs.

I’m looking for a way to have seconds display as mm:ss on a y access via the python API.

Hi @jsm, doesn’t have specific support for the timedelta type. I think you could use a datetime array and then format the ticks to only display hh:mm:ss (using the yaxis.tickformat property).

Feel free to add a reproducible example if you’d like help working through the details,



Thanks! That did the trick. White iterating over the values in the CSV, I just used this:


and formatted the axis with:

    range=[min(Pace)-datetime.timedelta(seconds=20), max(Pace) + datetime.timedelta(seconds=20)]

and everything worked as expected.

1 Like