You must enable Javascript to view this page correctly. knitr rgl error
I have knitr: 1.10.5 and rgl: 0.95.1247.
When I try to execute the code:
```output:
html_document:
keep_md: yes```
```{r setup, results='asis'}
library(knitr)
knit_hooks$set(webgl = hook_webgl)
```
```{r testgl, webgl=TRUE}
library(rgl)
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
```
I am getting an error: You must enable Javascript to view this page correctly. Javascript enabled, browseURL function in rgl works great.
Who knows what the problem is?
+3
source to share
1 answer
There are a number of issues with the hook_webgl approach. Using rglwidget () is the currently recommended method:
```output:
html_document:
keep_md: yes```
```{r testgl}
library(rgl)
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
rglwidget()
```
0
source to share