Description of Problem
I'd like to include an interactive (rotating) rgl 3-d scatterplot in a .pdf knitted from a .Rnw file. I know there is a hook for including rgl
but maybe this is for html output only. I can't seem to include the plot so that it rotates. Here is a minimal example. The plot appears but there are lines rather than points and no rotation available.
Question(s)
- Is including the interactive rgl in a pdf possible?
- If so...How can I do this with knitr?; what am I doing incorrectly?
MWE
\documentclass{article}
\begin{document}
<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
library(rgl)
knit_hooks$set(rgl = hook_rgl)
@
<<fancy-rgl, rgl=TRUE>>=
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
# open3d()
plot3d(x, y, z, col = 'black')
@
\end{document}