Skip to content

Commit

Permalink
Dynamically assign pathGrob in .onLoad() to prevent packages that sub…
Browse files Browse the repository at this point in the history
…class GeomPolygon from throwing an install warning. Fixes #3312. (#3331)
  • Loading branch information
paleolimbot authored and clauswilke committed May 15, 2019
1 parent 291cd7e commit 8406115
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,21 @@
})
}

# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon
# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ':
# unused argument (pathId = munched$group)` despite the fact that this is correct
# usage
pathGrob <- NULL

.onLoad <- function(...) {
backport_unit_methods()

if (getRversion() < as.numeric_version("3.6")) {
pathGrob <<- function(..., pathId.lengths) {
grid::pathGrob(...)
}
}

.zeroGrob <<- grob(cl = "zeroGrob", name = "NULL")

ggplot_global$theme_current <- theme_gray()
Expand Down

0 comments on commit 8406115

Please sign in to comment.