Skip to content

Commit 2f06dd5

Browse files
committed
resolve gnarlyness in S3/S7 method conflicts
1 parent bbdc7a5 commit 2f06dd5

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

NAMESPACE

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ S3method(fortify,sfg)
5555
S3method(fortify,summary.glht)
5656
S3method(fortify,tbl)
5757
S3method(fortify,tbl_df)
58-
S3method(get_alt_text,ggplot)
59-
S3method(get_alt_text,ggplot_built)
58+
S3method(get_alt_text,"ggplot2::ggplot")
59+
S3method(get_alt_text,"ggplot2::ggplot_built")
6060
S3method(get_alt_text,gtable)
6161
S3method(grid.draw,absoluteGrob)
6262
S3method(grobHeight,absoluteGrob)
@@ -91,7 +91,9 @@ S3method(predictdf,default)
9191
S3method(predictdf,glm)
9292
S3method(predictdf,locfit)
9393
S3method(predictdf,loess)
94+
S3method(print,"ggplot2::ggplot")
9495
S3method(print,"ggplot2::mapping")
96+
S3method(print,"ggplot2::theme")
9597
S3method(print,element)
9698
S3method(print,ggplot2_bins)
9799
S3method(print,ggproto)

R/labels.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ get_alt_text <- function(p, ...) {
280280
UseMethod("get_alt_text")
281281
}
282282
#' @export
283-
get_alt_text.ggplot <- function(p, ...) {
283+
`get_alt_text.ggplot2::ggplot` <- function(p, ...) {
284284
alt <- p@labels[["alt"]] %||% ""
285285
if (!is.function(alt)) {
286286
return(alt)
@@ -291,7 +291,7 @@ get_alt_text.ggplot <- function(p, ...) {
291291
get_alt_text(build)
292292
}
293293
#' @export
294-
get_alt_text.ggplot_built <- function(p, ...) {
294+
`get_alt_text.ggplot2::ggplot_built` <- function(p, ...) {
295295
alt <- p@plot@labels[["alt"]] %||% ""
296296
p@plot@labels[["alt"]] <- NULL
297297
if (is.function(alt)) alt(p@plot) else alt

R/plot.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ plot_clone <- function(plot) {
229229
#' @param ... other arguments not used by this method
230230
#' @keywords hplot
231231
#' @return Invisibly returns the original plot.
232-
#' @name print.ggplot
232+
#' @export
233+
#' @method print ggplot2::ggplot
233234
#' @usage
234235
#' print(x, newpage = is.null(vp), vp = NULL, ...)
235236
#' plot(x, newpage = is.null(vp), vp = NULL, ...)
@@ -247,7 +248,7 @@ plot_clone <- function(plot) {
247248
#' print(ggplot(mpg, aes_(~ displ, ~ hwy, colour = colour)) +
248249
#' geom_point())
249250
#' }
250-
S7::method(print, class_ggplot) <-
251+
`print.ggplot2::ggplot` <-
251252
S7::method(plot, class_ggplot) <-
252253
function(x, newpage = is.null(vp), vp = NULL, ...) {
253254
set_last_plot(x)

R/theme.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,4 +959,5 @@ combine_elements <- function(e1, e2) {
959959
.subset2(x, ...)
960960
}
961961

962-
S7::method(print, theme) <- function(x, ...) utils::str(x)
962+
#' @export
963+
`print.ggplot2::theme` <- function(x, ...) utils::str(x)

man/is_tests.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/print.ggplot.Rd renamed to man/print.ggplot2-colon-colon-ggplot.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)