From e158e621c873b8ee78554702fec8ed1ede089e8b Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Fri, 27 Jun 2025 10:13:21 +0200 Subject: [PATCH] instantiate default_annotation on load --- R/plot_annotation.R | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/R/plot_annotation.R b/R/plot_annotation.R index 6f53f2f..47c8509 100644 --- a/R/plot_annotation.R +++ b/R/plot_annotation.R @@ -86,16 +86,21 @@ plot_annotation <- function(title = waiver(), subtitle = waiver(), caption = wai theme = th ), class = 'plot_annotation') } -default_annotation <- plot_annotation( - title = NULL, - subtitle = NULL, - caption = NULL, - tag_levels = character(), - tag_prefix = '', - tag_suffix = '', - tag_sep = '', - theme = NULL -) + +default_annotation <- NULL +on_load({ + default_annotation <- plot_annotation( + title = NULL, + subtitle = NULL, + caption = NULL, + tag_levels = character(), + tag_prefix = '', + tag_suffix = '', + tag_sep = '', + theme = NULL + ) +}) + #' @importFrom utils modifyList #' @export ggplot_add.plot_annotation <- function(object, plot, object_name) {