Rayshader plot_gg在运行示例时崩溃

问题描述 投票:0回答:1

我尝试从https://www.tylermw.com/3d-ggplots-with-rayshader/复制下面的rayshader示例:

library(rayshader)
library(ggplot2)
library(tidyverse)
library(sf)
library(viridis)

nc = st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
gg_nc = ggplot(nc) +
  geom_sf(aes(fill = AREA)) +
  scale_fill_viridis("Area") +
  ggtitle("Area of counties in North Carolina") +
  theme_classic()

plot_gg(gg_nc, multicore = TRUE, width = 6 ,height=2.7, fov = 70)

但是运行plot_gg行,我得到以下错误消息:

if(iftype(%in%c(“ text”,“ line”))中的错误{:参数长度为零

关于那里发生的事情有什么想法吗?

r ggplot2 rayshader
1个回答
0
投票

将您的代码修改为:

theme_set(theme_classic())

gg_nc = ggplot(nc) +
  geom_sf(aes(fill = AREA)) +
  scale_fill_viridis("Area") +
  ggtitle("Area of counties in North Carolina")

plot_gg(gg_nc, multicore = TRUE, width = 6 ,height=2.7, fov = 70)
© www.soinside.com 2019 - 2024. All rights reserved.