I plotted my data and integrated the p-value into my plot, but unfortunately in some cases the statistical significant differences between two groups are shown double in the plot, but I only want it to be shown once for each comparisonenter image description here
I tried to delete one bracket or even one comparison but I could not find a way to specifically delete one of two brackets, which are double. If I use a higher number of "n", than the double brackets disappear.
#Lactate Experiment ##Prepare Dataset
Lactate.data_long <- Lactate.data %>%
                                    gather(key = "variable", value = "value", -Tube.Nr., -Oxygen.condition, -Cell.type, -Experiment, -Day, -Well, -Label)
Lactate.data_long$variable <- factor(Lactate.data_long$variable, levels = c("Lactate", "Glucose"))
levels(Lactate.data_long$variable) <- c("Lactate", "Glucose")
Lactate.data_long <- Lactate.data_long %>% 
                        dplyr::rename(test = variable)
##Statistics Metabolites (all Wells)
stat_Metabolites.test <- Lactate.data_long %>%
                                  group_by(Oxygen.condition, Day, test) %>%
                                  dunn_test(value ~ Cell.type) %>%
                                  add_xy_position(x = "test") %>%
                                  arrange(p.adj)
stat_Metabolites.test
##Statistics Metabolites (Experiment)
stat_Metabolites.test.exp <- Lactate.data_long %>%
                                  group_by(Oxygen.condition, Day, test, Experiment) %>%
                                  dunn_test(value ~ Cell.type) %>%
                                  add_xy_position(x = "test") %>%
                                  arrange(p.adj)
stat_Metabolites.test.exp
##Plot
Lactate_plot <- ggplot(Lactate.data_long, aes(x = test, y = value)) +
                    geom_boxplot(aes(fill = Cell.type),
                                  size = 0.8,
                                  alpha = 0.6,
                                 color = "black",
                                 lwd = 0.2,
                                 outlier.shape = NA,
                                 position = position_dodge(width = 0.75)) +
                    stat_summary(fun = mean,
                               geom = "point",
                               size = 1.7,
                               fill = "white",
                               shape = 23,
                               color = "black",
                               alpha = 1,
                               aes(group = Cell.type),
                               position = position_dodge(width = 0.75)) +
#                    coord_cartesian(ylim = c(0, 50)) +
#                    scale_y_continuous(breaks=seq(0,50, 5)) +
                    scale_fill_manual(values = colors_Lactate) +
                    ylab(expression(bold(paste("concentration")))) +
                    # geom_label(data = prolif_des.stat, aes(x = time, group = celltype, label = paste0("n=", n),
                    #                                        y = 0),
                    #            position = position_dodge(width = 0.75),
                    #            size = 2.5,
                    #            fontface = "bold",
                    #            color = "gray40") +
                    facet_grid(Oxygen.condition ~ Day) +
                    theme_bw() + 
                    stat_pvalue_manual(stat_Metabolites.test.exp,
                                                 label = "p.adj.signif",
                                                 size = 5,
#                                                 y.position = 40,
                                                 bracket.size = 0.3,
                                                 remove.bracket = FALSE,
                                                 hide.ns = TRUE) +
                              theme(legend.title = element_blank(),
                                    #legend.position = c(0.1, 0.9),
                                    legend.position = "top",
                                    legend.text = element_text(size = 7, face = "bold"),
                                    legend.text.align = 0,
                                    legend.background = element_blank(), 
                                    legend.key = element_blank(),
                                    panel.border = element_rect(colour = "black", size=.5),
                                    axis.title.y = element_text(size= 9, face = "bold", colour = "black"),
                                    axis.title.x = element_blank(),
                                    axis.ticks = element_line(colour = "black", size = .3),
                                    panel.grid.minor = element_blank(),
                                    panel.grid.major = element_line(size=0.2),
                                    axis.text.y = element_text(size = 7, face = "bold", colour = "black"),
                                    axis.text.x = element_text(size = 9, face = "bold", colour = "black"),
                                    axis.ticks.length=unit(.5, "mm"),
                                    strip.text = element_text(color = "black", size = 9, face = "bold"),
                                    panel.spacing = unit(1, "mm"))
Lactate_plot
#ggsave(paste0(export.dir, "_Lactate_plot.pdf"), plot = Lactate_plot, height = 4.5, width = 9, units = "cm")
