Skip to content
Prev 361634 / 398506 Next

save rgl.sphere plot

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