including a interactive 3D figure with knitr including a interactive 3D figure with knitr r r

including a interactive 3D figure with knitr


I added a new hook hook_webgl() in knitr, which was incorporated into rgl later. Here is an example:

```{r setup}library(knitr)library(rgl)knit_hooks$set(webgl = hook_webgl)``````{r testgl, webgl=TRUE}x <- sort(rnorm(1000))y <- rnorm(1000)z <- rnorm(1000) + atan2(x,y)plot3d(x, y, z, col=rainbow(1000))```