5

I have knitr: 1.10.5 and rgl:0.95.1247.

When i try 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 get the error: You must enable Javascript to view this page properly. Javascript is enabled, and the browseURL function in rgl works fine.

Anyone who knows what the problem is?

gman
  • 100,619
  • 31
  • 269
  • 393
Shat32
  • 51
  • 2
  • I received this same error, and going to the path of the rmarkdown project, right-click the .html file, open in Google Chrome, Firefox, etc. shows the correct plot without any error. It still shows the comment still though, but I was fine with it still being there. – DDrake Jan 05 '18 at 20:21

1 Answers1

1

There have been a number of problems 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()
```
user2554330
  • 37,248
  • 4
  • 43
  • 90