y <- function(x) { x^2
} curve(y, from=1, to=50, xlab=‘x’, ylab=‘y’)
y <- function(x) {2^x}
curve(y, from=1, to=10, xlab=“x”, ylab=“y”)

The above codes are from https://stackoverflow.com/a/26091375.