Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:37:31+00:00 2026-06-18T05:37:31+00:00

I’m plotting line graphs in Python Matplotlib of times which I get in mm:ss.tttt

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:37:32+00:00Added an answer on June 18, 2026 at 5:37 am

    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:

    import matplotlib.pyplot as plt                                                 
    from matplotlib import ticker  
    

    Create your own value formatting function:

    def format_10Kth_time(time, pos=None):                                          
        mins     = time // (10000 * 60)                                             
        secs     = (time - (mins * 10000 * 60)) // (10000)                          
        fracsecs = time % 10000                                                     
        return "%d:%02d.%d" % (mins, secs, fracsecs)
    

    Then in my plot code I did this to alter the Y axis formatting:

    plt.gca().yaxis.set_major_formatter(ticker.FuncFormatter(format_10Kth_time))
    plt.plot(...) 
    plt.show() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.