Hi all I have generated a 3D interactive rgl.sphere but I don't know how to save it to be viewed also interactive(being able to rotate it and do zoom-in and out). Does anyone know how should I save it? Thanks for any help! Elahe
http://stackoverflow.com/questions/7663982/r-using-rgl-to-generate-3d-rotatable-plots-that-can-be-viewed-in-a-web-browser Sent from my iPhone> On Jun 10, 2016, at 9:14 AM, ch.elahe via R-help <r-help at r-project.org> wrote: > > Hi all > I have generated a 3D interactive rgl.sphere but I don't know how to save it to be viewed also interactive(being able to rotate it and do zoom-in and out). Does anyone know how should I save it? > Thanks for any help! > Elahe > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
On 10/06/2016 9:14 AM, ch.elahe via R-help wrote:> Hi all > I have generated a 3D interactive rgl.sphere but I don't know how to save it to be viewed also interactive(being able to rotate it and do zoom-in and out). Does anyone know how should I save it? > Thanks for any help!I'd recommend using knitr and rglwidget. For example, put this in example.Rmd: --- title: "Example" author: "Duncan Murdoch" date: "June 10, 2016" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} options(rgl.useNULL = TRUE) library(rgl) library(rglwidget) xyz <- matrix(rnorm(30), ncol = 3) spheres3d(xyz, col = 1:10) rglwidget() ``` and then in RStudio, click on "knit HTML". If you don't use RStudio, you can run rmarkdown::render("example.Rmd") and then view the "example.html" file in your browser. Duncan Murdoch