1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| library(ggplot2)
library(sf)
x <- st_sfc(st_point(c(5, 5)))
bbox <- st_bbox(x)
xsize <- 10
ysize <- 5
bbox <- bbox + c(xsize / 2, ysize / 2,- xsize / 2, - ysize / 2)
pol_sf <- st_sf(a = 1, geom = st_as_sfc(bbox))
gg <- ggplot() +
geom_sf(data = pol_sf, fill = NA, color = "orange", size = 1, linetype = 1)
gg <- gg + theme(
panel.background = element_rect(fill = "grey"),
plot.background = element_rect(fill = "blue")
)
plot(gg)
pdf_file <- "issue_ggsave.pdf"
ggsave(pdf_file) |
Partager