I am doing a plot for a conference and would like to add more significance bars. This is my code:
bxp_stress <-
subjstress %>%
ggboxplot( x = "timetask",
y = "Stress",
fill = "group",
xlab = "timepoint",
ylab = "subjective rating [VAS]",
title = "Subjective stress"
)+
scale_fill_manual(values = my_palette) +
scale_x_discrete(labels = c("pre-ctrl", "post-ctrl", "pre-stress", "post-stress")) +
geom_signif(comparisons = list(c("MAST_pre", "MAST_post"), c("plac_post", "MAST_post")),
annotations = "***",
step_increase = 0.05,
map_signif_level = TRUE,
vjust = 0.4,
tip_length = 0)
And how my plot looks:
Now I would like to add significance bars for "post-stress between the three groups (that are defined within the "fill" argument of ggboxplot).
How can I do this, as signicance is only found between 2 of the groups (NC vs. IUD) and I don't want an overall significance, as I am getting using this code:
bxp_stress + stat_compare_means(aes(group = group), label = "p.signif")
Edit: This is what I am imagining:
Boxplot with drawn stat bracket
Edit2: useable dataframe
subjstress <- tibble(
group = rep(c("NC", "IUD", "OC"), each = 232),
timetask = rep(c("plac_pre", "plac_post", "MAST_pre", "MAST_post"), times = 174),
Stress = sample(0:100, 696, replace = TRUE)
)