ggplot2显着性水平,带星号且p值已调整

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

我是R语言的初学者,我想知道是否可以使用ggplot2软件包在数据可视化方面获得一些帮助。

我正在尝试使用调整后的p值(通过Bonferroni校正)标记显着性水平,而不是使用星号标记正常p值。

我尝试的代码是...

stat_compare_means(aes(label=..p.adj.., group=sample_type), label = "p.signif", method = "t.test", hide.ns = TRUE)

stat_compare_means(aes(group=sample_type), p.adjust.method = "bonferroni", label = "p.signif", method = "t.test", hide.ns = TRUE)
r ggplot2 statistics p-value
1个回答
0
投票

请参见EnvStats程序包。作者提供的示例是:

library(ggplot2)
library(EnvStats)
p <- ggplot(mtcars, aes(x = factor(cyl), y = mpg, color =     
factor(cyl))) + theme(legend.position = "none")

dev.new()
p + geom_point() +
stat_n_text() + stat_mean_sd_text() +
stat_test_text() +
labs(x = "Number of Cylinders", y = "Miles per Gallon")
© www.soinside.com 2019 - 2024. All rights reserved.