Skip to content

save rgl.sphere plot

3 messages · Elahe chalabi, David Winsemius, Duncan Murdoch

#
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 10/06/2016 9:14 AM, ch.elahe via R-help wrote:
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