Closed trevorld closed 2 years ago
9d82d73 should fix this for the geom_sf_pattern()
case. If grobs clipped by R 4.1 clipping paths are not clipped by viewports then this could still theoretically happen with geom_polygon_pattern()
and perhaps other geoms if you use the "rose", "text", or custom patterns that use the R 4.1 clipping path feature to clip patterns to their polygon boundaries.
Bug description
Pattern may escape
{ggplot2}
plot window if R 4.1 clipping enabled. In particular most likely to affect geoms that have holed polygons such asgeom_sf_pattern()
and perhapsgeom_polygon_pattern()
.Minimal, reproducible example
Workarounds
1) Set
options(ggpattern_use_R4.1_clipping = FALSE)
to use the raster clipping alternative to the R 4.1 clipping feature2) Clip the shapes with
{sf}
prior to plotting?Potential future fixes
I guess a grid viewport's clipped setting won't work on clipping paths of interior grobs? Is this a bug in the graphics device that can be fixed? Should we try to manually clip shapes with
{sf}
ingeom_sf_pattern()
before plotting?