当我渲染 Rayshader 图形时,它会在我的 mac 上弹出打开 Xquartz,没问题,但如果我想将它包含在我的 Rmarkdown 文档中,它只显示代码,没有图形?我知道这是一个繁重的图形密集型渲染,但正在寻找任何提示。谢谢,下面是我的代码:
---
title: "rayshader"
author: "Daniel"
date: "6/16/2020"
output:
html_document:
self_contained: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r cars}
library(rayshader)
#Here, I load a map with the raster package.
loadzip = tempfile()
download.file("https://tylermw.com/data/dem_01.tif.zip", loadzip)
localtif = raster::raster(unzip(loadzip, "dem_01.tif"))
unlink(loadzip)
#And convert it to a matrix:
elmat = raster_to_matrix(localtif)
elmat %>%
sphere_shade(texture = "desert") %>%
add_water(detect_water(elmat), color = "desert") %>%
add_shadow(ray_shade(elmat, zscale = 3), 0.5) %>%
add_shadow(ambient_shade(elmat), 0) %>%
plot_3d(elmat, zscale = 10, fov = 0, theta = 135, zoom = 0.75, phi = 45, windowsize = c(1000, 800))
```