Say I have the following data that I want to plot:
x <- seq(.01, 1, .01)
plot(x)
Great. However, I want to change the scaling of the y-axis. I know that I can do
plot(x, log='y')
Is there an equivalent of this for exponential scaling?
(I know I could just plot(exp(x))
but this is part of a pretty complex plotting function that I am writing and I'd like to make this an optional parameter.)
Any help is greatly appreciated!
You can do this in ggplot2 using coord_trans
:
library(scales)
library(ggplot2)
x <- seq(.01, 1, .01)
y <- seq(.01, 1, .01)
data <- data.frame(x, y)
qplot(x, y, data = data) + coord_trans(y = "exp")