Reputation: 189
I want to manually set the range of Y axis. I want manually increase values of Y axis by 30 units. I have a following code:
library(scales)
library(ggplot2)
ggplot(mtcars,aes(x=wt,y=mpg)) +
geom_point() +
geom_smooth() +
scale_y_continuous(trans = ~.+30)
But I got the following error message:
Error in match.fun(f) : 'c("~_trans", ". + 30_trans")' is not a function, character or symbol
Can somebody help me?
Upvotes: 0
Views: 141
Reputation: 19384
If you just want to change the labels, then this will do it.
ggplot(mtcars, aes(x=wt,y=mpg)) +
geom_point() +
geom_smooth() +
scale_y_continuous(labels=function(x) x+30)
Upvotes: 4