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
______________________________________________
R-help@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.