Force R to stop plotting abbreviated axis labels - e.g. 1e+00 in ggplot2
In ggplot2 how can I stop axis labels being abbreviated - e.g. 1e+00, 1e+01
along the x axis once plotted? Ideally, I want to force R to display the actual values which in this case would be 1,10
.
Any help much appreciated.
Solution 1:
I think you are looking for this:
require(ggplot2)
df <- data.frame(x=seq(1, 1e9, length.out=100), y=sample(100))
# displays x-axis in scientific notation
p <- ggplot(data = df, aes(x=x, y=y)) + geom_line() + geom_point()
p
# displays as you require
require(scales)
p + scale_x_continuous(labels = comma)
Solution 2:
Did you try something like :
options(scipen=10000)
before plotting ?
Solution 3:
Just an update to what @Arun made, since I tried it today and it didn't work because it was actualized to
+ scale_x_continuous(labels = scales::comma)