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

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")?


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

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)

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.

Here's an example to get you started:

x <- 1:10
y <- runif(10) * 1e6

yrange <- c(0, 1e6)
ticks <- pretty(yrange)
labels <- format(ticks, big.mark=",", scientific=FALSE)

plot(y~x, yaxt="n", ylim = yrange)
axis(2, at = ticks, labels = labels, las = 1, cex.axis=0.7) 

Use format and scientific=FALSE:

a<-c(100000, 200000)
format(a, scientific=FALSE)

Need Your Help

Why getchar() behaves differently?

c getchar

I found getchar() is behaving differently in some situations.

JQuery PHP change URL from select box

javascript php jquery

I have single page with div element , that changes color regarding of selected color.