r - Include rgl interactive plot in .Rnw (pdf output) -


description of problem

i'd include interactive (rotating) rgl 3-d scatterplot in .pdf knitted .rnw file. know there hook including rgl maybe html output only. can't seem include plot rotates. here minimal example. plot appears there lines rather points , no rotation available.

question(s)

  1. is including interactive rgl in pdf possible?
  2. if so...how can knitr?; 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} 

what see in pdf:

enter image description here

it's possible, barely. need install asymptote, , use rgl::writeasy() write program it. include program in document, run latex, asymptote, latex again.

there examples of including asymptote in latex here: http://asymptote.sourceforge.net/doc/latex-usage.html#latex-usage.

the results kind of disappointing.

my advice abandon pdf. html5 better target output; rgl quite job (using rglwidget()) producing output web pages. it's unlikely effort put improving pdf output, whereas fixing remaining gaps in html support priority.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -