Removing NS from ggplot

Hello, newbie here! I am trying to create a boxplot with multiple comparisons (repeated measures). When using the function hide.ns = True in the stat_pvalue_manual function, I am able to hide the non-significant (ns) values but a big gap is left in between the significant values. Does anyone know a way to remove these non significant values (ns) or hide them in a way that does not leave a big gap in between values?

Thank you in advance!

##pairwise comparison
pwc <- df %>%
pairwise_t_test(
y ~ x, paired = TRUE,
p.adjust.method = "none"
)
pwc

print(pwc, n = nrow(pwc))

##boxplot
p <- ggplot(df, aes(x, y, color=x, add = "jitter")) + geom_boxplot() +
theme_classic() + labs(x = "Period", y = "Pain Pressure Threshold (kg)", color = "Condition") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))
p

##adding stats
p <- p +
stat_pvalue_manual(pwc, tip.length = 0.01, hide.ns = TRUE)
labs(
subtitle = get_test_label(res.aov, detailed = TRUE),
caption = get_pwc_label(pwc)
)
p

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.