Rayshader plot_gg 在 运行 示例时崩溃
Rayshader plot_gg crashes while running example
我尝试重现以下来自 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")) { 错误:参数长度为零
知道那里发生了什么吗?
将您的代码修改为:
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)
我尝试重现以下来自 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")) { 错误:参数长度为零
知道那里发生了什么吗?
将您的代码修改为:
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)