R中报错Error in `ggsignif::geom_signif()`:! Problem while computing stat.ℹ Error occurred in the 2nd

p=ggplot(umap)+geom_violin(aes(x=recur_T_NT,y=PHF14,fill=recur_T_NT))
p+ stat_compare_means(comparisons = list(c("NR_NT","NR_T"),c("NR_NT","R_NT"),c("NR_T","R_T"),c("R_NT","R_T")),family = "TT Times New Roman",method = "wilcox.test",label = "p.signif",#标记p值的方法
                      label.x = 1.5#调整p值所在位置
)

[1] FALSE
Error in `ggsignif::geom_signif()`:
! Problem while computing stat.
ℹ Error occurred in the 2nd layer.
Caused by error in `setup_params()`:
! Can only handle data with groups that are plotted on the x-axis

报错原因:发现映射关系被我写在了geom_violin()里面,因此stat_compare_means()无法读取数据,正确的写法应该如下

p=ggplot(umap,aes(x=recur_T_NT,y=PHF14,fill=recur_T_NT))+geom_violin()
p+ stat_compare_means(comparisons = list(c("NR_NT","NR_T"),c("NR_NT","R_NT"),c("NR_T","R_T"),c("R_NT","R_T")),family = "TT Times New Roman",method = "wilcox.test",label = "p.signif",#标记p值的方法
                      label.x = 1.5#调整p值所在位置
)

参考ggsignif报错:Can only handle data with groups that are plotted on the x-axis-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值