I know how to plot with R's default plotting function. How do I do the same thing as the following R-code in ggplot2?
double <- function(x){
return(x^2)
}
triple <- function(x){
return(x^3)
}
xs <- seq(-3,3,0.01)
dou <- double(xs)
tri <- triple(xs)
plot(rep(xs, 2), c(dou, tri), typ="n")
lines(xs, dou, col="red")
lines(xs, tri, col="green")