1

我试图从https://www.tylermw.com/3d-ggplots-with-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 (whichtype %in% c("text", "line")) { 中的错误:参数长度为零

知道那里发生了什么吗?

4

1 回答 1

1

将您的代码修改为:

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)
于 2020-04-22T15:07:11.017 回答