From 80f198b4a5e2511ef91f1a7e34a20be41501cf2d Mon Sep 17 00:00:00 2001 From: Alboukadel Kassambara Date: Sun, 2 Jun 2019 09:45:15 +0200 Subject: [PATCH] grouped plot position guessed automatically --- R/stat_pvalue_manual.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/stat_pvalue_manual.R b/R/stat_pvalue_manual.R index 8a5d2c92..cb266ad2 100644 --- a/R/stat_pvalue_manual.R +++ b/R/stat_pvalue_manual.R @@ -169,8 +169,10 @@ stat_pvalue_manual <- function( group2 <- NULL data <- add_ctr_rows(data, ref.group = ref.group) mapping <- aes(x = xmin, y = y.position, label = label, group = group2) - if(missing(position) & is_grouping_variable(x)) - position <- position_dodge(0.8) + if(missing(position) & !missing(x)){ + if (is_grouping_variable(x)) + position <- position_dodge(0.8) + } } else{ mapping <- aes(x = xmin, y = y.position, label = label)