ggplot2 axis scale always comes out in scientific numbers. How do I change it

Viewed 36
alpha <- data2[1:63,]
alpha
alpha$Population_2017
library(ggplot2)
alpha$Population_2017 <- as.numeric(alpha$Population_2017)
alpha$Population_2001 <- as.numeric(alpha$Population_2001)
chart <- ggplot( data = alpha, aes(x = `Gini_coefficient_2016`, y = `GVA_per_worker_2017__£`,  color=`Region`, size = Population_2017))
chart + geom_point(aes(x=`Population_2001`)) + xlab("Population_2001")

Here is my code. Not sure why the legends and scale show scientific numbers.

1 Answers

You can set the labels argument in a scale to a formatting function, e.g:

library(ggplot2)

df <- data.frame(
  x = (1:10)*1e6,
  y = rnorm(10)
)

ggplot(df, aes(x, y)) +
  geom_line() +
  scale_x_continuous(labels = scales::number)

Created on 2020-04-03 by the reprex package (v0.3.0)

Related