tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.05k stars 211 forks source link

plot_gg output has grey drawing errors #138

Closed jzadra closed 3 years ago

jzadra commented 3 years ago

I'm plotting an sf object using geom_sf. The output has a grey area that moves as I rotate the output in Xquartz.

ggobj <- cmap17 %>% ggplot(aes(fill = lbs_sqmile)) + geom_sf(lwd = 0, show.legend = F) + theme_void() + scale_fill_viridis() ggobj: image

image

Additionally when I rotate it to look at it from the edge, there doesn't appear to be any 3D height: image

plot_gg(ggobj, raytrace = F, preview = F, multicore = T, width = 5, height = 5, scale = 150, offset_edges = F, windowsize = c(1200, 1200))

I have tried setting options(rgl.useNULL = FALSE) prior to loading the rayshader library.

XQuartz versio 2.7.11 ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────── setting value
version R version 4.0.2 (2020-06-22) os macOS Catalina 10.15.7
system x86_64, darwin17.0
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Denver
date 2020-12-19

rgl 0.103.5 2020-11-23 [1] CRAN (R 4.0.2) rayshader * 0.20.0 2020-12-02 [1] Github (tylermorganwall/rayshader@f08ef70)

jzadra commented 3 years ago

Update: This also seems to be a problem for other aesthetics. I tried with geom_hex but had the same issue. It also seems that it isn't clearing the device, as it's plotting the new geom_hex and I can still see the map I tried to plot previously.

image

bastian1213 commented 3 years ago

Hey @jzadra , did you solve the issue? I'm having the exact same problem

3D_spain

3D_spain

bastian1213 commented 3 years ago

Hey @jzadra,

I figured it out. the problem is that you have + theme_void() in the ggplot function

jzadra commented 3 years ago

Yes, that fixed it for me too! Thanks.