【发布时间】:2022-07-06 04:48:41
【问题描述】:
当我尝试将 p 值添加到具有不同比例的多面 ggplot 时,它们会发生偏移,尽管在 facet_wrap 到 ggplot 和 add_xy_position 到 stats 我表示 scales="free":
我的代码块:
stat_c <- dat_c %>%
group_by(antigen , region) %>%
wilcox_test(norm_mean ~ genotype , alternative = "greater") %>%
adjust_pvalue(method = "bonferroni") %>%
add_significance("p.adj") %>%
add_xy_position(x = "region" , dodge = 0.8 , scales = "free")
plt_c <- ggplot(dat_c , aes(x = region , y = norm_mean , color = genotype)) +
geom_boxplot(outlier.shape=NA) +
geom_jitter(position=position_jitterdodge()) +
facet_wrap(~antigen , scales = "free" ) +
ggtitle(label = "DRS hit IHC in tent5c KO")
plt_c +
stat_pvalue_manual(stat_c , label = "p.adj") +
scale_y_continuous(expand = expansion(mult = c(0,0.1)))
如果有任何帮助,我将不胜感激!
【问题讨论】:
-
请提供足够的代码,以便其他人更好地理解或重现问题。
标签: r ggplot2 charts p-value ggpubr