Thursday, January 31, 2013

Plot dots + functions with R

library("ggplot2")
eq<-function(x){x*x}
tmp<-data.frame(x=data[,4],y=eq(data[,5]))

p<-qplot(x,y,data=tmp)
c<-stat_function(fun=eq)
print(p+c)

or

qplot(x, y, data=as.data.frame(curve(eq)), geom="line")

No comments:

Post a Comment