@@ -193,6 +193,9 @@ layer_grob <- get_layer_grob
193193# ' to (e.g.) make the legend box 2 cm wide, or combine multiple plots into
194194# ' a single display, preserving aspect ratios across the plots.
195195# '
196+ # ' The `ggplot_gtable()` function is vestigial and the `gtable_ggplot()` function
197+ # ' should be used instead.
198+ # '
196199# ' @seealso
197200# ' [print.ggplot()] and [benchplot()] for
198201# ' for functions that contain the complete set of steps for generating
@@ -203,12 +206,12 @@ layer_grob <- get_layer_grob
203206# ' @keywords internal
204207# ' @param data plot data generated by [ggplot_build()]
205208# ' @export
206- ggplot_gtable <- S7 :: new_generic(" ggplot_gtable " , " data" , function (data ) {
209+ gtable_ggplot <- S7 :: new_generic(" gtable_ggplot " , " data" , function (data ) {
207210 attach_plot_env(data @ plot @ plot_env )
208211 S7 :: S7_dispatch()
209212})
210213
211- S7 :: method(ggplot_gtable , class_ggplot_built ) <- function (data ) {
214+ S7 :: method(gtable_ggplot , class_ggplot_built ) <- function (data ) {
212215 plot <- data @ plot
213216 layout <- data @ layout
214217 data <- data @ data
@@ -309,6 +312,18 @@ S7::method(ggplot_gtable, class_ggplot_built) <- function(data) {
309312 plot_table
310313}
311314
315+ # TODO: the S3 generic should be phased out once S7 is adopted more widely
316+ # ' @rdname gtable_ggplot
317+ # ' @export
318+ ggplot_gtable <- function (plot ) {
319+ UseMethod(" ggplot_gtable" )
320+ }
321+
322+ # ' @export
323+ ggplot_gtable.default <- function (plot ) {
324+ gtable_ggplot(plot )
325+ }
326+
312327# ' Generate a ggplot2 plot grob.
313328# '
314329# ' @param x ggplot2 object
0 commit comments