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

  • Home
  • SEARCH
  • 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 7065471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:57:37+00:00 2026-05-28T04:57:37+00:00

I have a plot that has $-amounts and dates on y and x axis

  • 0

I have a plot that has $-amounts and dates on y and x axis respectively. Currently the dollar amounts range from $0-15 million. Something like this:

x <- rnorm(20)^2 * 1000000
plot(x)

R does stuff like '1.0e+07' instead of '10,000,000' and also orients the text vertically instead of horizontally.

My questions are:

1) how would I get the scale text to be horizontally oriented?

2) how would I get R to use 10MM instead of '10,000,000' or '1.0e+07'?

  • 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-05-28T04:57:37+00:00Added an answer on May 28, 2026 at 4:57 am

    1) See the scipen option in ?options which is a penalty against the use of scientific notation. For better control, you need to plot the axis by hand with labels you want.

    2) See las in ?par which controls to orientation crudely of axis labels.

    For 1):

    x <- rnorm(20)^2 * 10000000
    layout(matrix(1:2, ncol = 2))
    plot(x)
    getOption("scipen")
    opt <- options("scipen" = 20)
    getOption("scipen")
    plot(x)
    options(opt)
    layout(1)
    

    which gives

    enter image description here

    To plot your own axis try

    plot(x / 10000000, axes = FALSE)
    axis(1)
    pts <- pretty(x / 10000000)
    axis(2, at = pts, labels = paste(pts, "MM", sep = ""))
    box()
    

    Which gives

    enter image description here

    Where we use pretty() to select pretty locations for the ticks just as R would and then add a custom axis. Notice how we suppress axis drawing in the plot() call and then add back the axes and the plot frame with calls to axis() and box().

    For 2) combining with 1)

    opt <- options("scipen" = 20)
    op <- par(mar = c(5,7,4,2) + 0.1) ## extra margin to accommodate tick labs
    x <- rnorm(20)^2 * 10000000
    plot(x, las = 1, ylab = "")       ## no y-axis label 
    title(ylab = "label", line = 5.5) ## need to plot the axis label
    par(op)
    options(opt)
    

    Which gives

    enter image description here

    Notice how we use las in the plot() call, and we need to create some extra margin space to accommodate the tick labels. We also need to plot the label by hand otherwise R will stick it in amongst the tick labels.

    For the custom axis labels, add the las = 1 to the axis() call:

    op <- par(mar = c(5,5,4,2) + 0.1)
    plot(x / 10000000, axes = FALSE, ylab = "")
    axis(1)
    pts <- pretty(x / 10000000)
    axis(2, at = pts, labels = paste(pts, "MM", sep = ""), las = 1)
    title(ylab = "my label", line = 4)
    box()
    par(op)
    

    Which produces

    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 plot that has data that runs into the area I'd like
I have a cherryPy program that returns a page that has an image (plot)
I have a data set that has two tab delimited columns that I plot
I have a plot with overlapping shaded confidence intervals that looks like this: and
I'm trying to create a plot using pyplot that has a discontinuous x-axis. The
I have a function f(x,y) which has certain symmetries that I would like to
I have a plot (sample code pasted below) that I am trying to add
I have the following data set that I am trying to plot with ggplot2,
Say that I have two figures in matplotlib, with one plot per figure: import
I have a scatter plot in R (with ggplot2). The data has a numeric

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.