I have a sample data frame as follows:
demo = data.frame(percent = c(84.9,71.4,82.6,69.0,94.1,94.8,91.6,86.5,21.4,70.7,92.3,94.4,28.8,21.8,93.7,87.2),
status = rep(c("Pre","Pre","Pre","Pre","Post","Post","Post","Post"),2),
gender = c(rep("Male",8),rep("Female",8)),
id = c(rep(c("1","2","3","4"),2),rep(c("5","6","7","8"),2)))
I then proceed to facet the data frame by gender and make a paired plot for each gender using status as the x variable and percent as the y variable using the following codes:
compare = list(c("Pre","Post"))
demo %>% ggplot(aes(x=factor(status,c("Pre","Post")),y=percent,group=id)) + ylim(0,101) +
geom_point(size = 2, aes(color = status)) + geom_line() +
facet_grid(~ gender,switch = "x") +
theme(legend.position = "none",
axis.title.x = element_blank(),
strip.placement = "outside",
strip.text.x = element_text(angle=0)) +
stat_compare_means(comparisons = compare,label="p.signif",
method = "t.test",paired=T,label.y=100.5,label.x = 1.5,tip.length=0)
Yet the output of this plot only has the asterisk and bracket for the Male group but not the Female group, but I want it to also have a bracket showing "NS" as label, I was wondering why the bracket disappeared? (p.s. I've also tried the hide.ns argument but it didn't work). It now looks like this:

