File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,6 @@ S3method(fortify,sfg)
55
55
S3method(fortify,summary.glht)
56
56
S3method(fortify,tbl)
57
57
S3method(fortify,tbl_df)
58
- S3method(get_alt_text,"ggplot2::ggplot")
59
- S3method(get_alt_text,"ggplot2::ggplot_built")
60
- S3method(get_alt_text,gtable)
61
58
S3method(grid.draw,absoluteGrob)
62
59
S3method(grobHeight,absoluteGrob)
63
60
S3method(grobHeight,zeroGrob)
Original file line number Diff line number Diff line change @@ -272,12 +272,12 @@ get_labs <- function(plot = get_last_plot()) {
272
272
# '
273
273
# ' get_alt_text(p)
274
274
# '
275
- get_alt_text <- function (p , ... ) {
275
+ get_alt_text <- S7 :: new_generic( " get_alt_text " , " p " , fun = function (p , ... ) {
276
276
warn_dots_used()
277
- UseMethod( " get_alt_text " )
278
- }
279
- # ' @export
280
- `get_alt_text.ggplot2::ggplot` <- function (p , ... ) {
277
+ S7 :: S7_dispatch( )
278
+ })
279
+
280
+ S7 :: method( get_alt_text , class_ggplot ) <- function (p , ... ) {
281
281
alt <- p @ labels [[" alt" ]] %|| % " "
282
282
if (! is.function(alt )) {
283
283
return (alt )
@@ -287,14 +287,14 @@ get_alt_text <- function(p, ...) {
287
287
build @ plot @ labels [[" alt" ]] <- alt
288
288
get_alt_text(build )
289
289
}
290
- # ' @export
291
- `get_alt_text.ggplot2::ggplot_built` <- function (p , ... ) {
290
+
291
+ S7 :: method( get_alt_text , class_ggplot_built ) <- function (p , ... ) {
292
292
alt <- p @ plot @ labels [[" alt" ]] %|| % " "
293
293
p @ plot @ labels [[" alt" ]] <- NULL
294
294
if (is.function(alt )) alt(p @ plot ) else alt
295
295
}
296
- # ' @export
297
- get_alt_text.gtable <- function (p , ... ) {
296
+
297
+ S7 :: method( get_alt_text , class_gtable ) <- function (p , ... ) {
298
298
attr(p , " alt-label" ) %|| % " "
299
299
}
300
300
You can’t perform that action at this time.
0 commit comments