Hi, I have a question about exporting interactive 3D plots. I use the following code to plot a contour of a trivariate normal distribution:
library(mvtnorm) library(rgl) library(misc3d) n=25 x=seq(-3,3,length=n) X=cbind(rep(x,each=n**2),rep(rep(x,each=n),n),rep(x,n**2)) p=array(dmvnorm(X,sigma=diag(3)*0.5+0.5),c(n,n,n)) contour3d(p,x,x,x,level=mean(p)) lim=c(-3,3) decorate3d(xlim=lim,ylim=lim,zlim=lim,xlab="Variable X",ylab="Variable Y",zlab="Variable Z") 1. I know thanks to Luke Tierney (www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/misc3d-pdf.pdf) how to export the 3D plot without the axes and labels with: dummy=function(...){ contour3d(p,x,x,x,level=mean(p),scale = FALSE,...) } conts=dummy() saveTrianglesAsOFF <- function(scene, filename = "scene.OFF") { scene <- misc3d:::colorScene(scene) triangles <- misc3d:::canonicalizeAndMergeScene(scene, "color", "color2", "alpha", "col.mesh", "fill", "smooth") ve <- misc3d:::t2ve(triangles) f <- file(filename, open = "w") on.exit(close(f)) write("OFF", f) write(c(ncol(ve$vb), ncol(ve$ib), 3 * ncol(ve$ib)), f, 3) write(ve$vb, f, 3) write(rbind(3, ve$ib - 1), f, 4) invisible(NULL) } saveTrianglesAsOFF(conts,"plot.OFF") However, I would like to have the axes and labels in the export as well. Simply adding the decorate3d to the dummy function does not work, nor does creating a separate dummy. (I do know how to combine multiple exports in Meshlab). Does anyone know how to do this in some way or the other, or is this simply not possible? Thanks, Peter van Rijn [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.