How can change he axis scale on a plot


I'm doing an EDA and one of my plots y axis keep using the 2e+05 instead of 200000. How can I change that?

Here is a print on how I wanted vs how I'm getting it:


Referred here by Forecasting: Principles and Practice, by Rob J Hyndman and George Athanasopoulos

Here is an example using the tidyverse


my_scales <- function(x) {
  scales::comma(x, big.mark = "")

# create reproducible simulated data
dat <- tibble(value1=runif(100, min=0, max=3E6),
                  Experiment=rep(c("Ago1", "Ago2", "Ago3", "Ago4"), 25),
                  variable=rep(c("Pos1", "Pos2", "Pos3", "Pos4", "Pos5"), 20),
                  value=sample(c("yes", "no"), 100, replace=TRUE))

dat %>% 
  ggplot(aes(x = variable, y = value1)) +
  geom_boxplot() + 
  scale_y_continuous(labels = my_scales)

1 Like