Line size in ggplot2 3.4.0 and rayshader

777 Views Asked by At

Just updated ggplot2 from 3.3.6 to 3.4.0. It has been documented that new version of ggplot2 replaced size with linewidth in geom_line() and geom_sf().

However, it appears that the new version does not get along well with rayshader package on my machine with Ubuntu 22.04.

ggplot2 3.3.6

library(tidyverse)
library(rayshader)
# df with geometry is not included
p <- df %>% ggplot() +
  geom_sf(aes(geometry = geometry, fill = value), color = "black", size = 0.25) +
  scale_fill_viridis_c(option = "C", limits = c(0, 100)) +
  coord_sf(xlim = c(100, 180), ylim = c(-60, -10)) +
  theme(legend.position = "none")
p
filename_movie <- tempfile()
plot_gg(p,
  zoom = 0.6,
  multicore = TRUE,
  raytrace = TRUE,
  phi = 30,
  theta = 0
)
render_snapshot(filename = "gr_1")
rgl::rgl.close()

enter image description here

The above is the expected graph.

ggplot2 3.4.0

I used the same code, only difference is that size = 0.25 was replaced by linewidth = 0.25. I got the following graph (obviously not correct). My current fix is to switch back to ggplot 3.3.6. It would be nice to use new ggplot2.

enter image description here

0

There are 0 best solutions below