dmurdoch/rgl

Embed rgl plots in vignette

luca-scr opened this issue · 2 comments

Hi Duncan,
following the release of version 1.0.1 on CRAN I have updated successfully the spinplot() function in my msir package. So far so good.
Unfortunately I have an issue with embedding a rgl plot in a vignette. Previously it worked fine, see the results at
https://cran.r-project.org/web/packages/msir/vignettes/msir.html#general-usage-of-spinplot-function
using code similar to the following

```{r, eval=requireNamespace("rgl", quietly = TRUE), echo=1}
spinplot(x1, y, x2)
rgl::rglwidget(width=500, height=450)
```

Full source code of vignette can be seen at https://github.com/luca-scr/msir/blob/master/vignettes/msir.Rmd
BTW, the following simple code embed the rgl graph with no problem:

```{r, eval=requireNamespace("rgl", quietly = TRUE), echo=1}
rgl::plot3d(x1,y,x2)
rgl::rglwidget()
```

Do you have any hint on how to fix this?
Many thanks in advance.

LS

Sorry for the delay on this -- somehow I missed noticing the issue.

This looks like a bug in rgl. I'll track it down and let you know when it is fixed.

I have found the bug, and will soon be committing a fix. The issue was a bug in conversion of the pch3d() points to WebGL. If you want a short term workaround, avoid that function, e.g. use pointst3d() or text3d() instead.