# NOT RUN {
# Create new files in tempdir
savedir <- setwd(tempdir())
x <- y <- seq(-10, 10, length = 20)
z <- outer(x, y, function(x, y) x^2 + y^2)
persp3d(x, y, z, col = 'lightblue')
title3d("Using LaTeX text", col = 'red', line = 3)
rgl.postscript("persp3da.ps", "ps", drawText = FALSE)
rgl.postscript("persp3da.pdf", "pdf", drawText = FALSE)
rgl.postscript("persp3da.tex", "tex")
rgl.pop()
title3d("Using ps/pdf text", col = 'red', line = 3)
rgl.postscript("persp3db.ps", "ps")
rgl.postscript("persp3db.pdf", "pdf")
rgl.postscript("persp3db.tex", "tex", drawText = FALSE)
setwd(savedir)
# }
# NOT RUN {
#
# create a series of frames for an animation
#
rgl.open()
shade3d(oh3d(), color = "red")
rgl.viewpoint(0, 20)
for (i in 1:45) {
rgl.viewpoint(i, 20)
filename <- paste("pic", formatC(i, digits = 1, flag = "0"), ".eps", sep = "")
rgl.postscript(filename, fmt = "eps")
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab