geom_signif 和 geom_bar/ggplot 叠加问题

问题描述 投票:0回答:0

geom_signif 仅适用于第一个蛋白质面。我收到的错误消息是“警告:无法计算带关系的精确 p 值”

ggplot(data = RecoveryStatistics, mapping = aes(x = Method, y = Recovery, fill = ProtChain))+
  geom_bar(stat = "identity", position = "dodge") + 
  geom_errorbar(aes(ymin = lower, ymax = upper), width=.2, position = position_dodge(.9))+
  facet_grid(ReplicateType~Protein)+
  scale_y_continuous(limits = c(0, 100))+
  labs(
    x = "Sample Method",
    y = "Recovery (%)" )+
  geom_signif(comparisons = list(c("Method1", "Method2"),
                                 c("Method2","Method3"),
                                 c("Method1", "Method3")),
              map_signif_level = TRUE,
              y_position = c(80,65,50))+
  theme_bw()+
  theme(axis.text.x = element_text(angle = 30,hjust = 1))

在上面的文字之前,这是我的代码。问题是当我在这里有 geom_errorbars 时,它不会将 ProteinChains 之间的条分开。

我知道它来自分组,但我不知道如何让 geom_signif 比较这些方法,但 geom_errorbars 在各自的通道中

ggplot(data = RecoveryStatistics, mapping = aes(x = SampleMethod, y = Recovery))+
  geom_bar(stat = "identity", position = "dodge", aes(fill = ProteinChain)) + 
  facet_grid(ReplicateType~Protein)+
  scale_y_continuous(limits = c(0, 100))+
  labs(
    x = "Sample Method",
    y = "Recovery (%)" )+
  geom_signif(comparisons = list(c("Method1", "Method2"),
                                 c("Method2","Method3"),
                                 c("Method1", "Method3"),
              map_signif_level = TRUE,
              y_position = c(80,65,50))+
  theme_bw()+
  theme(axis.text.x = element_text(angle = 30,hjust = 1))

r ggplot2 facet geom-bar significance
© www.soinside.com 2019 - 2024. All rights reserved.