Changing y-axis tick labels from standard form to the full number

r

Solution

See the scipen option in `?options`. Here is an example:

set.seed(42)
dat <- data.frame(x = runif(100, min = 0, max = 1000000),
                  y = runif(100, min = 0, max = 1000000))

layout(matrix(1:2, ncol = 2))
plot(y ~ x, data = dat)
opt <- options(scipen = 10)
plot(y ~ x, data = dat)
options(opt)
layout(1)

Which produces:

Other options include suppressing the axes with `axes = FALSE` in the `plot()` call and then use `axis()` to add your own axes with custom supplied labels using `format()`; see `?format` for details. This is the way to go if you really want the "," in the numbers separating the thousands.

Problem

I made a scatterplot and the y-axis range runs from 0 to 800,000. How can I make the y-axis ticks show the numbers ("0", "200,000", "400,000", "600,000", "800,000") instead of their standard forms ("0e+00", "2e+05", "4e+05", "6e+05", "8e+05")?

Original source