To add curves in ggplot, you can use the stat_function as follows:
library("ggplot2")
ggplot(data.frame(x=c(0, 10)), aes(x)) + stat_function(fun=cos)
To add complex curves, you can use the lambda function as follows:
ggplot(data.frame(x=c(0, 10)), aes(x)) +
stat_function(fun=function(x) sin(x) + log(x))