ggpubr 缺少显著性注释

ggpubr missing significance annotations

提问人:falco 提问时间:7/25/2023 最后编辑:falco 更新时间:7/25/2023 访问量:22

问:

我想得到一个带有重要性注释的条形图。我正在使用以下三个库:tidyverse、ggpubr、rstatix 和 reprex。

我正在使用此要点中的数据集和代码,只需复制和粘贴即可获得所需的一切:https://gist.github.com/drfalco/9402b52e1fee4c64ed3f1ca622344b99

最终图中仅存在“stat.test.melt.dfi3.agree”第 2 行中的显著性水平。相反,“stat.test.melt.dfi3.agree”的第 3、4、5 行中的三个显著性水平在最终图中不存在。我收到以下“警告消息:删除了 3 行包含非有限值 (stat_bracket())”。

你看到'stat.test.melt.dfi3.agree'有什么问题吗?我怎样才能得到图上缺失的三个注释?

r tidyverse ggpubr rstatix

评论


答:

0赞 Allan Cameron 7/25/2023 #1

您已将 in 设置为,但正在尝试将括号绘制到高于 5 的括号。在 中设置 y 轴限制时,将删除不在该范围内的任何几何图形,并收到有关缺少行的警告。limitsc(0, 5)scale_y_continuousstat_pvalue_manualggplot

您需要做的就是删除参数,或将其设置为包含所有括号。这个值似乎相当不错:limitsc(0, 5.45)

melt.dfi3.agree %>%
  ggplot(aes(DPType, Judgment))+
  stat_summary(fun = "mean",
               geom = "bar")+
  stat_summary(fun.data = mean_se,
               geom = "errorbar",
               width = .5)+ 
  scale_x_discrete("Position and agreement")+
  scale_y_continuous("Judgement / Acceptabilty",
                     expand = expansion(mult = c(0, 0.1)), 
                     limits = c(0, 5.45))+
  ggtitle("Agreement effects in Italian: 'La metà' and 'Metà'") +
  stat_pvalue_manual(stat.test.melt.dfi3.agree, 
                     hide.ns = TRUE, tip.length = 0.01)

enter image description here