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 9239097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:54:30+00:00 2026-06-18T07:54:30+00:00

When I boxplot some data measured in seconds in R, how can I change

  • 0

When I boxplot some data measured in seconds in R, how can I change the scale of the y axis from seconds to minutes and seconds?

For example when I do something like this:

data <- c(298, 507, 1008, 346)
boxplot(data)

I get a boxplot with an y axis from 300 to 1000. I would like to have “5:00” to “16:40” there instead, simply the seconds converted to minutes and seconds.

  • 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-18T07:54:31+00:00Added an answer on June 18, 2026 at 7:54 am

    Here’s an attempt. It turns the y axis off first and then converts the data to minutes and adds it to the y-axis as tickmarks.

    data <- c(298, 507, 1008, 346)
    boxplot(data, yaxt="n")
    at <- axTicks(2)
    axis(2, at=at, labels=sprintf("%d:%02d", at %/% 60, at %% 60), las=1)
    

    To provide a little explanation:

    axTicks “Computes pretty tickmark locations, the same way as R does internally.” (from ?axTicks).

    %% will give you the remainder after division, while %/% will, if given x %/% y tell you how many times x goes into y.

    Finally, sprintf is used for formatting strings and will pad the calculated seconds value to always append leading 0‘s if required, i.e. – 2 becomes 02.

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a boxplot looking like this : Boxplot( ~ km_piste, data=slide, id.method=y, col=orange)
I am plotting boxplots from this data: MY_LABEL MY_REAL MY_CATEGORY 1 [POS] .56 POS
I am using a regression model for some data whose explanatory variables can only
I have a ROC.Value data frame that looks like this: Years 1 2 3
I have a set of data that looks like this, species<-ABC ind<-rep(1:4,each=24) hour<-rep(seq(0,23,by=1),4) depth<-runif(length(ind),1,50)
I have a nearly-boxplot like jitter-plot: dt <- rbind(se,cb,cb.se) qplot(ds, size, data=dt, geom="jitter", colour=root,
Here my script to generate boxplot from precomputed data : mydata <-structure(list(v_rank=1:100,min=c(1876.12908723494,525.833257030355, 479.174444926073,413.317971868729,283.212605297879,272.271743111746, 271.218577609491,261.097920232602,249.848244413854,239.6826693619,
I've got some multivariate data of beauty vs ages. The ages range from 20-40
I'm looking to plot something similar to this in R. Can this be this
Here is a boxplot: qplot(cyl, mpg, data=mtcars) + geom_boxplot() + scale_y_continuous() that looks like

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.