'How to remove brackets within stat_compare_means?

Is there a way to remove the brackets from stat_compare_means that indicate the comparisons one chose? I would like to remove the brackets of non-significant comparisons but hide.ns only removes the p-value.

I put an example below.

Thank you!

library(tidyr)
library(ggpubr)
library(dplyr)


data("airquality")
head(airquality)


df <- 
  airquality %>% 
  filter(Month %in% c(5,7,9)) %>% 
  pivot_longer(cols = c(Ozone, Solar.R, Wind, Temp), 
               values_to = "Value", 
               names_to = "Var")


df %>% ggplot(aes(x = as.factor(Month), y = Value))+
  geom_point()+
  facet_wrap(vars(Var), scales = "free_y")+
  stat_compare_means(comparisons = list(c("5", "7"), 
                                        c("5", "9"), 
                                        c("7", "9")), 
                     
                     method = "t.test",
                     aes(label = ..p.signif..),
                     hide.ns = T)

How can I remove the empty brackets? Is there another workaround for this?

How can I remove the empty brackets? Is there another workaround for this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source