From 98136d789d74c00b628178986257b2474a6689d9 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Fri, 26 Sep 2025 13:29:52 +0200 Subject: [PATCH] add format method --- R/plot-construction.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/R/plot-construction.R b/R/plot-construction.R index 188e5cc574..b65890cc32 100644 --- a/R/plot-construction.R +++ b/R/plot-construction.R @@ -268,3 +268,12 @@ new_layer_names <- function(layer, existing) { names <- c(existing, new_name) vec_as_names(names, repair = "check_unique") } + +local({ + S7::method(format, class_gg) <- function(x, ...) { + x <- S7::S7_class(x) + # Similar to S7:::S7_class_name + x <- paste(c(x@package, x@name), collapse = "::") + format(paste0("<", x, ">"), ...) + } +})