You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I set panel.background to white, plot_gg shows the edges of the polygons from my data. These are not shown by ggplot nor when I set panel.background to black. Or even when I don't set a panel at all.
Is this a bug in plot_gg or am I missing something? (changing the crs from 28992 to 4326 does not make a difference)
Reproducible code (as copied from StackOverflow):
library(ggplot2)
library(rayshader)
library(sf)
temp <- tempfile()
download.file("https://www.cbs.nl/-/media/cbs/dossiers/nederland-regionaal/vierkanten/500/2022-cbs_vk500_2021_v1.zip", temp)
NLD <- read_sf(utils::unzip(temp, "cbs_vk500_2021_v1.gpkg"))
#NLD <- NLD[-c(99:nrow(NLD)),] # enable for faster testing
NLD$aantal_inwoners <- ifelse(NLD$aantal_inwoners < 0, 1, NLD$aantal_inwoners)
kaart <- ggplot(NLD)+
geom_sf(aes(fill=aantal_inwoners), colour=NA) +
scale_fill_gradient(high="deeppink", low="black") +
theme_void() +
theme(legend.position = "none")
#This second part is required to keep a white background in plot_gg (otherwise it is black).
kaart <- kaart + theme(panel.background = element_rect(fill="white", color="white"),
plot.background = element_rect(fill = "white", color="white"))
kaart
plot_gg(kaart, width = 3, height = 3, multicore = TRUE,
zoom = .7, theta = 0, phi = 90, windowsize = c(800, 800))
This is what is produced by ggplot:
And this is what is produced by plot_gg:
This data shows the distribution of the population in The Netherlands in squares of 500x500 m.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
(also discussed on StackOverflow where it was suggested that this may be a bug in Rayshader) https://stackoverflow.com/questions/75121533/rayshader-how-to-prevent-that-plot-gg-displays-edges-of-polygons
When I set
panel.background
to white,plot_gg
shows the edges of the polygons from my data. These are not shown byggplot
nor when I setpanel.background
to black. Or even when I don't set a panel at all.Is this a bug in plot_gg or am I missing something? (changing the crs from 28992 to 4326 does not make a difference)
Reproducible code (as copied from StackOverflow):
This is what is produced by ggplot:
And this is what is produced by plot_gg:
This data shows the distribution of the population in The Netherlands in squares of 500x500 m.
Beta Was this translation helpful? Give feedback.
All reactions