suppressMessages(library("plot3D"))
xSeq <- seq(range(df$xSeq)[1], range(df$xSeq)[2], length.out = 30)
ySeq <- seq(range(df$ySeq)[1], range(df$ySeq)[2], length.out = 30)
## persp requires a matrix for z
zSeq <- outer(xSeq, ySeq, function(a,b) predict(glm.fit, newdata=data.frame(xSeq=a, ySeq=b), type="response"))
persp(x=xSeq, y=ySeq, z=zSeq, ticktype="detailed", theta=40, phi=15)
persp(x=xSeq, y=ySeq, z=zSeq, ticktype="detailed", theta=0, phi=0)
persp(x=xSeq, y=ySeq, z=zSeq, ticktype="detailed", theta=90, phi=0)
see http://pj.freefaculty.org/guides/Rcourse/plot-3d/plots-3d.pdf for details.
No comments:
Post a Comment