I am creating a book with bookdown
and I have run the scatter3d()
function from car
and rgl
.
I have read that 3D images can be interactivelly implemented in HTML (here), however, what I need is to implement a simply plain image in the PDF output.
How can I do it?
Let's use this example:
scatter3d(mpg~hp+qsec|factor(cyl), data=mtcars, surface=FALSE, residuals=TRUE,
parallel=FALSE, bg="white", axis.scales=TRUE, grid=TRUE, ellipsoid=TRUE)
EDIT 1
By employing @user2554330 's answer, I created an R Markdown file (.Rmd):
---
title: "Untitled"
author: "Mario"
date: "1 July 2019"
output:
pdf_document: default
html_document: default
---
```{r echo=FALSE}
library(rgl)
library(car)
setupKnitr()
```
Here's a plot:
```{r echo=TRUE, dev="png", rgl=TRUE}
scatter3d(mpg~hp+qsec|factor(cyl), data=mtcars, surface=FALSE, residuals=TRUE,
parallel=FALSE, bg="white", axis.scales=TRUE, grid=TRUE, ellipsoid=TRUE)
```
However, when I convert my .Rmd file to PDF, I do not see the plot:
Where's the problem?