From b68bb95980cc2498f7bf93b493aa3a4737a85533 Mon Sep 17 00:00:00 2001 From: Yunuuuu Date: Thu, 9 Jan 2025 09:54:45 +0800 Subject: [PATCH] add panel border for ggmark and cross_mark --- R/cross-mark.R | 2 +- R/ggmark.R | 2 +- R/ggplot-theme.R | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/cross-mark.R b/R/cross-mark.R index 90792d67..8167184e 100644 --- a/R/cross-mark.R +++ b/R/cross-mark.R @@ -37,7 +37,7 @@ cross_mark <- function(mark, data = waiver(), reorder = NULL, obs_size = 1, cross(CrossMark, data = data, mark = mark, reorder = reorder, obs_size = obs_size, plot = ggplot(), size = size, - schemes = default_schemes(), + schemes = default_schemes(th = theme_panel_border()), active = active, inherit_nobs = inherit_nobs, inherit_panel = inherit_panel, diff --git a/R/ggmark.R b/R/ggmark.R index f5549b6d..b9c63145 100644 --- a/R/ggmark.R +++ b/R/ggmark.R @@ -81,7 +81,7 @@ ggmark <- function(mark, data = waiver(), mapping = aes(), ..., # slot plot = ggplot(mapping = mapping), size = size, - schemes = default_schemes(data), + schemes = default_schemes(data, th = theme_panel_border()), active = active ) } diff --git a/R/ggplot-theme.R b/R/ggplot-theme.R index 92bb8543..973328cc 100644 --- a/R/ggplot-theme.R +++ b/R/ggplot-theme.R @@ -28,6 +28,8 @@ theme_no_strip <- function() { ) } +theme_panel_border <- function() theme(panel.border = element_rect(fill = NA)) + #' @importFrom utils packageVersion #' @importFrom rlang try_fetch complete_theme <- function(theme) {