Skip to content

Commit b4c1604

Browse files
authored
add as.gtable() method (#421)
1 parent 00ff756 commit b4c1604

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ License: MIT + file LICENSE
2020
Encoding: UTF-8
2121
Imports:
2222
ggplot2 (>= 3.0.0),
23-
gtable,
23+
gtable (>= 0.3.6),
2424
grid,
2525
stats,
2626
grDevices,

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ S3method("[[<-",patchwork)
99
S3method("|",ggplot)
1010
S3method(add_patches,ggplot)
1111
S3method(add_patches,patchwork)
12+
S3method(as.gtable,patchwork)
1213
S3method(as.list,patchwork)
1314
S3method(as_patch,formula)
1415
S3method(as_patch,gList)
@@ -150,6 +151,7 @@ importFrom(grid,upViewport)
150151
importFrom(grid,valid.just)
151152
importFrom(grid,viewport)
152153
importFrom(grid,widthDetails)
154+
importFrom(gtable,as.gtable)
153155
importFrom(gtable,gtable)
154156
importFrom(gtable,gtable_add_cols)
155157
importFrom(gtable,gtable_add_grob)

R/plot_patchwork.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ patchworkGrob <- function(x) {
290290
class(gtable) <- setdiff(class(gtable), 'gtable_patchwork')
291291
gtable
292292
}
293+
294+
#' @importFrom gtable as.gtable
295+
#' @export
296+
as.gtable.patchwork <- function(x, ...) patchworkGrob(x)
297+
293298
plot_table <- function(x, guides) {
294299
UseMethod('plot_table')
295300
}

0 commit comments

Comments
 (0)