including a interactive 3D figure with knitr

后端 未结 1 1614
再見小時候
再見小時候 2020-11-30 21:21

Using knitr it is possible to embed a rgl 3D graphics in a html document from a Rmarkdown source file:

```{r setup}
li         


        
相关标签:
1条回答
  • 2020-11-30 22:14

    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))
    ```
    
    0 讨论(0)
提交回复
热议问题