0

I am using the rayshader package in R to render a 3D plot with plot_gg() function. I get a black background in the plot and want to remove it.

Here is my code:

gg_ma = ggplot(ma_sff) +
  geom_sf(aes(fill = pro.pop), lwd=0) +
  geom_sf(data=river3, col="white") +
  annotate(geom="text", x=104.5, y=16, color="red", size=7.5, label= paste(round(ma_sff$prop.ma[1],1), "% dân số", sep = "")) +
  scale_fill_viridis("Tỉ lệ (%)", direction = -1, option = "viridis") +
  ggtitle("Họ Mã") +
  theme_bw() +
  theme(text = element_text(size=15), axis.text.x = element_text(size=15), axis.text.y = element_text(size=15), legend.text=element_text(size=15)) +
  theme(legend.key.height = unit(10, "mm"),
        legend.key.width = unit(1, "mm"))

plot_gg(gg_ma, multicore = TRUE, raytrace = T, width = 10, height = 15, 
       scale = 300, windowsize = c(3500, 2165), zoom = 0.6, phi = 30, theta = 30, background = "white")

This is what I get

What can I do?

Thanks!

Duc Du
  • 1
  • 1
  • You might look at this suggestion here: https://stackoverflow.com/questions/75447425/why-is-the-background-of-my-plot-black-when-i-use-plot-gg-from-rayshader-in-r – Oluwafemi Oyedele Jul 16 '23 at 19:09

0 Answers0