【发布时间】:2022-07-08 12:19:39
【问题描述】:
我正在尝试创建一个分面箱线图,其显着性水平用星号表示,如“***”。 问题是,尝试添加 geom_signif 层时出现错误。
Warning message:忽略未知美学:xmin、xmax、注释、y_position、map_signif_level。
这是我的数据:
veg_un <- structure(list(Datum = structure(c(3L, 3L, 1L, 1L, 3L, 3L, 2L,
3L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 3L, 1L, 2L, 2L, 2L), .Label = c("2021-04-08",
"2021-05-17", "2021-07-07"), class = "factor"), Soll = c("1192",
"1192", "149", "2484", "552", "172", "1192", "1189", "2484",
"552", "552", "552", "119", "1192", "2484", "1202", "149", "552",
"1202", "1202"), Entfernung = structure(c(2L, 1L, 1L, 2L, 2L,
2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("2",
"5"), class = "factor"), DGUnkraut = c(0, 1.3, 0.3, 3.4, 0, 2.5,
4, 0, 1, 0.9, 0, 0.8, 0.5, 3, 1, 0.2, 0.2, 4, 0.5, 5)), row.names = c(NA,
-20L), class = "data.frame")
这是我目前的代码。
library(tidyverse)
library(ggsignif)
library(ggpubr)
anno_df <- compare_means(DGUnkraut ~ Entfernung, group.by = "Soll", data = veg_un, p.adjust.method = "holm") %>%
mutate(y_pos = 7, p.adj = format.pval(p.adj, digits = 2))
ggplot(veg_un, aes(x=Entfernung, y=DGUnkraut)) +
geom_boxplot(position=position_dodge()) +
geom_point(aes(color=Entfernung), position=position_jitterdodge()) +
facet_wrap(~Soll) +
theme_minimal()+
ggsignif::geom_signif(
inherit.aes = F,
data=anno_df,
aes(xmin=group1, xmax=group2, annotations=p.adj, y_position=y_pos, map_signif_level = T),
manual=TRUE)
我不知道为什么会这样。另外,p值太高了。我试着用y_position来修改这个,但是由于我无法控制美观,所以它不起作用。
【问题讨论】: