a couple of months ago, i wanted to embed a 3D interactive plot in a markdown file. looking at previous questions, i found this, which worked great (thanks for that, BTW).
however, when i tried to re do it again today- i can only zoom in and out with the mouse and can not rotate the graph. i've also checked the markdown file that i made before and used to work and i also get the same issue. this happens in Rstudio "browser" thingy (the thing that pops up after you knit) and also in Chrome.
here are two examples, one with rgl package and one with car package, both not working for me (both used to work):
1
```{r setup}
library(knitr)
library(rgl)
knit_hooks$set(webgl = hook_webgl)
```
```{r, rgl=TRUE}
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
```
2
```{r setup}
library(knitr)
library(rgl)
knit_hooks$set(webgl = hook_webgl)
```
```{r testgl, webgl=TRUE}
library(car)
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
scatter3d(x, y, z , point.col = "blue", surface=FALSE, xlab = "", ylab = "C", zlab = "")
```
i'm using Rstudio 0.99.489, i've updated all the packages and using R 3.2.3
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] car_2.1-1 rgl_0.95.1441
loaded via a namespace (and not attached):
[1] Rcpp_0.12.3 lattice_0.20-33 digest_0.6.9 MASS_7.3-45 grid_3.2.3 MatrixModels_0.4-1
[7] nlme_3.1-122 SparseM_1.7 minqa_1.2.4 nloptr_1.0.4 Matrix_1.2-3 rmarkdown_0.9.2
[13] splines_3.2.3 lme4_1.1-10 tools_3.2.3 parallel_3.2.3 pbkrtest_0.4-6 yaml_2.1.13
[19] mgcv_1.8-9 htmltools_0.3 nnet_7.3-11 quantreg_5.19
thank you all for helping