r - ggplot条形图问题的p值
问题描述
我正在尝试将 p 值添加到通过 ggplot 生成的条形图中,但我不断收到此错误:FUN(X[[i]], ...) 中的错误:找不到对象 'Category2'
任何帮助,将不胜感激!谢谢。
stat.test <- compare_means(Sigma2 ~ Category2, data = data, method="t.test")
p4<- ggplot(df3, aes(x=Category2, y=Sigma2, fill=Category2)) +
geom_bar(stat="identity", color="black", position=position_dodge()) +
geom_errorbar(aes(ymin=Sigma2-se, ymax=Sigma2+se), width=.2, position=position_dodge(.9)) +
labs(title="Site 1", x="", y = "")+
theme(panel.background = element_blank()) +
theme(legend.title = element_blank()) +
theme(legend.position="none") +
theme(plot.title = element_text(size = 10,hjust = 0.5)) +
theme(panel.border = element_rect(colour = "black", fill=NA, size=1)) +
scale_fill_manual(values=c("springgreen4","violetred4")) +
coord_cartesian(ylim=c(0.03,0.06)) +
stat_pvalue_manual(stat.test, label = "p.adj", tip.length = 0.01,y.position = 22) +
scale_y_continuous(expand = c(0, 0))
解决方案
推荐阅读
- graphql - Apollo 客户端内省查询
- javascript - ng-repeat 不显示来自 http 请求的数据。检查时得到评论
- ruby-on-rails - 无法弄清楚如何在 Rails 5 应用程序中创建 Stripe 订阅的 URL 参数中传递优惠券
- java - ArrayList 将空传递给函数
- agora.io - WebRTC 与 Agora.io:SwitchCamera?
- java - Firebase 使用 addTextChangedListener 检查用户名是否存在
- php - 如何完全删除订单页面上的订单标题?
- javascript - 在 html5 filereader for javascript 中使用位置 url 而不是输入文件来选择文件
- reactjs - 用户拒绝 React.js 和文件夹访问
- typescript - 使用电子邮件和密码进行 Angular6 Firebase 身份验证