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)
5555S3method(fortify,summary.glht)
5656S3method(fortify,tbl)
5757S3method(fortify,tbl_df)
58- S3method(get_alt_text,"ggplot2::ggplot")
59- S3method(get_alt_text,"ggplot2::ggplot_built")
60- S3method(get_alt_text,gtable)
6158S3method(grid.draw,absoluteGrob)
6259S3method(grobHeight,absoluteGrob)
6360S3method(grobHeight,zeroGrob)
Original file line number Diff line number Diff line change @@ -272,12 +272,12 @@ get_labs <- function(plot = get_last_plot()) {
272272# '
273273# ' get_alt_text(p)
274274# '
275- get_alt_text <- function (p , ... ) {
275+ get_alt_text <- S7 :: new_generic( " get_alt_text " , " p " , fun = function (p , ... ) {
276276 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 , ... ) {
281281 alt <- p @ labels [[" alt" ]] %|| % " "
282282 if (! is.function(alt )) {
283283 return (alt )
@@ -287,14 +287,14 @@ get_alt_text <- function(p, ...) {
287287 build @ plot @ labels [[" alt" ]] <- alt
288288 get_alt_text(build )
289289}
290- # ' @export
291- `get_alt_text.ggplot2::ggplot_built` <- function (p , ... ) {
290+
291+ S7 :: method( get_alt_text , class_ggplot_built ) <- function (p , ... ) {
292292 alt <- p @ plot @ labels [[" alt" ]] %|| % " "
293293 p @ plot @ labels [[" alt" ]] <- NULL
294294 if (is.function(alt )) alt(p @ plot ) else alt
295295}
296- # ' @export
297- get_alt_text.gtable <- function (p , ... ) {
296+
297+ S7 :: method( get_alt_text , class_gtable ) <- function (p , ... ) {
298298 attr(p , " alt-label" ) %|| % " "
299299}
300300
You can’t perform that action at this time.
0 commit comments