相关文章推荐
留胡子的杨桃  ·  db.createUser({ ...·  10 月前    · 
冷静的山寨机  ·  Spring ...·  1 年前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have this same question. I tried to follow the methods here but I couldn't get it to work:
#48 (comment)

I want to overlay p-values for a subset of comparisons ONLY to the treated data to a base plot that looks like this:

ggbarplot(d=d, x = "Group",y="response",color="Treatment",add = "mean_se",position = position_dodge(0.8))

When I add stat_compare_means for the treated plot I get this:
my_comparisons=list(c("C1","C2"), c("A","C2"), c("C2","B"), c("C2","D"), c("D","E"), c("D","F")) d.treated <- d[d$Treatment == "treated",] ggbarplot(d=d, x = "Group",y="response",color="Treatment",add = "mean_se",position = position_dodge(0.8))+ stat_compare_means(d.treated,comparisons=my_comparisons)

However, this is ignoring use of the treated group for stat_compare_means. When I run as facet I see the p-values I actually want displayed on the plot.

ggbarplot(d=d, x = "Group",y="response",color="Treatment",facet.by="Treatment",add = "mean_se",position = position_dodge(0.8))+ stat_compare_means(comparisons=my_comparisons)

Is it possible to get the data from the right panel on my first image? Per the above solution I updated all my packages and it still is not working. Can I overlay two ggbarplots like geom_line and geom_point in ggplot? I haven't been able to get that to work.

Thanks!
My first time posting so apologies if I'm not following protocol!

Solutions are now provided in this blog post: How to Add P-Values onto a Grouped GGPLOT using the GGPUBR R Package

You need to install the latest dev version of rstatix and ggpubr:

devtools::install_github("kassambara/rstatix")
devtools::install_github("kassambara/ggpubr")