Closed trevorld closed 2 years ago
Patterns may fill holes when using recent versions of {ragg} and R 4.1 clipping is enabled.
This affects geom_sf_pattern() and geom_polygon_pattern() when they have holes.
geom_sf_pattern()
geom_polygon_pattern()
library("ggplot2") library("ggpattern") library("ragg") this_sf <- structure(list(id = 1L, geometry = structure(list(structure(list( structure(c(0, 4, 4, 0, 0, 0, 0, 4, 4, 0), .Dim = c(5L, 2L)), structure(c(1, 2, 2, 1, 1, 1, 1, 2, 2, 1), .Dim = c(5L, 2L))), class = c("XY", "POLYGON", "sfg"))), n_empty = 0L, crs = structure(list( input = NA_character_, wkt = NA_character_), class = "crs"), class = c("sfc_POLYGON", "sfc"), precision = 0, bbox = structure(c(xmin = 0, ymin = 0, xmax = 4, ymax = 4), class = "bbox"))), class = c("sf", "data.frame"), sf_column = "geometry", row.names = 1L) p <- ggplot(this_sf) + geom_sf_pattern(aes(geometry = geometry), fill = 'lightblue') ragg::agg_png("sf_hole_ragg.png") options(ggpattern_use_R4.1_clipping = TRUE) plot(p) dev.off()
Workarounds:
options(ggpattern_use_R4.1_clipping = FALSE)
png(type = "cairo")
ragg::agg_png("sf_hole_ragg_no_clipping.png") options(ggpattern_use_R4.1_clipping = FALSE) plot(p) dev.off() grDevices::png("sf_hole_cairo.png", type = "cairo") options(ggpattern_use_R4.1_clipping = TRUE) plot(p) dev.off()
Patterns may fill holes when using recent versions of {ragg} and R 4.1 clipping is enabled.
This affects
geom_sf_pattern()
andgeom_polygon_pattern()
when they have holes.Workarounds:
options(ggpattern_use_R4.1_clipping = FALSE)
png(type = "cairo")