Skip to content

Commit 0668f5c

Browse files
authored
add as.gtable methods (#6372)
1 parent bbc4d53 commit 0668f5c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Imports:
3535
cli,
3636
grDevices,
3737
grid,
38-
gtable (>= 0.1.1),
38+
gtable (>= 0.3.6),
3939
isoband,
4040
lifecycle (> 1.0.1),
4141
rlang (>= 1.1.0),

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ S3method("[[",ggproto)
1313
S3method("[[<-",uneval)
1414
S3method(.DollarNames,ggproto)
1515
S3method(as.data.frame,mapped_discrete)
16+
S3method(as.gtable,ggplot)
17+
S3method(as.gtable,ggplot_built)
1618
S3method(as.list,ggproto)
1719
S3method(autolayer,default)
1820
S3method(autoplot,default)

R/plot-build.R

+6
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ ggplotGrob <- function(x) {
312312
ggplot_gtable(ggplot_build(x))
313313
}
314314

315+
#' @export
316+
as.gtable.ggplot <- function(x, ...) ggplotGrob(x)
317+
318+
#' @export
319+
as.gtable.ggplot_built <- function(x, ...) ggplot_gtable(x)
320+
315321
# Apply function to layer and matching data
316322
by_layer <- function(f, layers, data, step = NULL) {
317323
ordinal <- label_ordinal()

0 commit comments

Comments
 (0)