1

I've tried to reproduce following rayshader example from 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)

but running the plot_gg line i get following error message:

Error in if (whichtype %in% c("text", "line")) { : argument is of length zero

Any idea on what's going on there?

  • It does not give me an error. May be updating your R software to the newest version with updated packages help you out. – UseR10085 Apr 17 '20 at 06:28

1 Answers1

1

Modify your code to:

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)
Daitu
  • 26
  • 4