如何使用自由比例(不同的 y 高度)自动分配 stat_compare_means() 中的 label.y 位置
How to automatically assign label.y position in stat_compare_means() under facet with free scale (different y-height)
我有以下数据框:
library(tidyverse)
library(ggpubr)
dat <- structure(list(genes = c("Gene1", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1"
), gexp = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
0, 0, 2,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Lin-", "Bc_Lin-", "Hd_Lin+",
"Ab_Lin-", "Hd_Lin+", "Tl_Lin-", "Ab_Lin+", "Bc_Lin+", "Bc_Lin-",
"Ab_Lin+", "Ab_Lin+", "Hd_Lin+", "Hd_Lin+", "Bc_Lin+", "Bc_Lin-",
"Ab_Lin+", "Hd_Lin-", "Tl_Lin+", "Bc_Lin+", "Tl_Lin-", "Tl_Lin-",
"Hd_Lin-", "Bc_Lin-", "Bc_Lin+", "Tl_Lin-", "Hd_Lin+", "Hd_Lin-",
"Tl_Lin+", "Hd_Lin-", "Bc_Lin+", "Hd_Lin+", "Hd_Lin+", "Bc_Lin+",
"Ab_Lin-", "Ab_Lin+", "Ab_Lin-", "Hd_Lin-", "Ab_Lin-", "Tl_Lin+",
"Bc_Lin+", "Bc_Lin-", "Hd_Lin+", "Bc_Lin-", "Ab_Lin+", "Hd_Lin+",
"Bc_Lin-", "Ab_Lin+", "Bc_Lin-", "Tl_Lin-", "Ab_Lin+", "Hd_Lin-",
"Bc_Lin+", "Ab_Lin-", "Hd_Lin+", "Hd_Lin+", "Bc_Lin+", "Ab_Lin+",
"Bc_Lin-", "Ab_Lin-", "Tl_Lin+", "Ab_Lin-", "Bc_Lin-", "Tl_Lin+",
"Ab_Lin-", "Hd_Lin-", "Ab_Lin+", "Tl_Lin-", "Tl_Lin+", "Bc_Lin+",
"Bc_Lin-", "Hd_Lin+", "Bc_Lin-", "Ab_Lin-", "Bc_Lin-", "Ab_Lin-",
"Hd_Lin+", "Ab_Lin-", "Hd_Lin-", "Ab_Lin-", "Bc_Lin+", "Ab_Lin+",
"Bc_Lin-", "Bc_Lin-", "Ab_Lin-", "Hd_Lin+", "Ab_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin+", "Hd_Lin+", "Bc_Lin-", "Bc_Lin-", "Bc_Lin-",
"Ab_Lin-")), row.names = c(NA, -732L), class = c("tbl_df", "tbl",
"data.frame"))
我要的是对GROUP列进行统计比较。
这是我的代码
sort_order <- c("Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-")
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
my_comparison <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-"))
ggpubr::ggbarplot(dat, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.456, by = 0, length.out = 4),seq( 0.125, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("")
正如您在下面的图中注意到的那样,Gene1 和 Gene2 的统计测试线相同。
如何针对自由 y 尺度的不同方面自动调整它?
这条线似乎不起作用:
label.y = c(seq( 0.456, by = 0, length.out = 4),seq( 0.125, by = 0, length.out = 4))
我们可以预先计算出每个基因的最大均值在这个范围内:0.4561404 0.1250000
.
这可能是完成任务的一种方式:
结果图:
代码
# your data
sort_order <- c("Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-")
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
my_comparison <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-"))
library(ggpubr)
library(tidyverse)
# data for Gene1
dat1 <- dat %>%
filter(genes=="Gene1")
# date for Gene2
dat2 <- dat %>%
filter(genes=="Gene2")
# plot p1
p1 <- ggpubr::ggbarplot(dat1, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.3, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("") +
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
# plot p2
p2 <- ggpubr::ggbarplot(dat2, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.6, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("") +
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
ggarrange(p1, p2, heights = c(4, 4), nrow = 1, align = "h")
说明
我试图在 facets 中访问 label.y,但失败了。看这里 https://github.com/kassambara/ggpubr/issues/50.
然后我决定应用一个解决方法:想法如下:
- 为每个基因创建一个单独的图,并通过过滤
dat1
将其与自己分面
对于 gene1
和 dat2
对于 gene2
.
- 这里的挑战是适应
ylim
,最后我通过这段代码实现了这个
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
现在您可以通过将 ..c(seq(0.3
更改为 ..c(seq(0.4
等来单独更改 stat_compare_means
的位置。
最后,您可以将两个图与 ggpubr
包
中的 ggarrange
结合起来
试试这个。它适用于任何数量的基因。无硬编码:
library(rstatix)
sort_order <- c(
"Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-"
)
my_comparisons <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-")
)
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
stat.test <- dat %>%
group_by(genes) %>%
t_test(gexp ~ GROUP, p.adjust.method = "none") %>%
add_xy_position(x = "GROUP", fun = "mean_se",
scales = "free", comparisons = my_comparisons, step.increase = 0) %>%
mutate(p.adj.signif = if_else(p.adj.signif == "", "NS.", p.adj.signif))
p <- ggpubr::ggbarplot(dat, x = "GROUP", y = "gexp", add = "mean_se",
facet = "genes", scales = "free"
) +
stat_pvalue_manual(stat.test, hide.ns = FALSE, tip.length = 0, bracket.nudge.y = 0.01) +
# scale_y_continuous(expand = expansion(mult = c(0.05, 0.5))) +
theme(strip.text.x = element_text(size = 20, colour = "black", face = "bold")) +
theme(legend.position = "none") +
xlab("") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
p
它产生:
我有以下数据框:
library(tidyverse)
library(ggpubr)
dat <- structure(list(genes = c("Gene1", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene2", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2", "Gene1",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene1", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene2", "Gene1", "Gene1",
"Gene2", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene1", "Gene2", "Gene2", "Gene2",
"Gene2", "Gene2", "Gene1", "Gene1", "Gene1", "Gene1", "Gene1",
"Gene2", "Gene1", "Gene1", "Gene2", "Gene1", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene1", "Gene2", "Gene1", "Gene1", "Gene1",
"Gene1", "Gene1", "Gene1", "Gene2", "Gene2", "Gene2", "Gene2",
"Gene1", "Gene2", "Gene2", "Gene2", "Gene1", "Gene1", "Gene1"
), gexp = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
0, 0, 0, 0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hd_Lin-", "Ab_Lin+", "Tl_Lin-", "Tl_Lin+", "Bc_Lin+",
"Bc_Lin-", "Hd_Lin+", "Bc_Lin-", "Ab_Lin-", "Bc_Lin-", "Ab_Lin-",
"Hd_Lin+", "Ab_Lin-", "Hd_Lin-", "Ab_Lin-", "Bc_Lin+", "Ab_Lin+",
"Bc_Lin-", "Bc_Lin-", "Ab_Lin-", "Hd_Lin+", "Ab_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin+", "Hd_Lin+", "Bc_Lin-", "Bc_Lin-", "Bc_Lin-",
"Ab_Lin-")), row.names = c(NA, -732L), class = c("tbl_df", "tbl",
"data.frame"))
我要的是对GROUP列进行统计比较。 这是我的代码
sort_order <- c("Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-")
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
my_comparison <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-"))
ggpubr::ggbarplot(dat, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.456, by = 0, length.out = 4),seq( 0.125, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("")
正如您在下面的图中注意到的那样,Gene1 和 Gene2 的统计测试线相同。
如何针对自由 y 尺度的不同方面自动调整它?
这条线似乎不起作用:
label.y = c(seq( 0.456, by = 0, length.out = 4),seq( 0.125, by = 0, length.out = 4))
我们可以预先计算出每个基因的最大均值在这个范围内:0.4561404 0.1250000
.
这可能是完成任务的一种方式:
结果图:
代码
# your data
sort_order <- c("Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-")
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
my_comparison <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-"))
library(ggpubr)
library(tidyverse)
# data for Gene1
dat1 <- dat %>%
filter(genes=="Gene1")
# date for Gene2
dat2 <- dat %>%
filter(genes=="Gene2")
# plot p1
p1 <- ggpubr::ggbarplot(dat1, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.3, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("") +
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
# plot p2
p2 <- ggpubr::ggbarplot(dat2, x = "GROUP", y = "gexp", add = "mean_se", facet.by = "genes",
scales = "free") +
stat_compare_means(aes(label = ..p.signif..),
label.y = c(seq( 0.6, by = 0, length.out = 4)),
tip.length = 0, vjust = 0.5,
method = "t.test", comparisons = my_comparison) +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5, size = 12)) +
xlab("") +
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
ggarrange(p1, p2, heights = c(4, 4), nrow = 1, align = "h")
说明
我试图在 facets 中访问 label.y,但失败了。看这里 https://github.com/kassambara/ggpubr/issues/50.
然后我决定应用一个解决方法:想法如下:
- 为每个基因创建一个单独的图,并通过过滤
dat1
将其与自己分面 对于gene1
和dat2
对于gene2
. - 这里的挑战是适应
ylim
,最后我通过这段代码实现了这个
coord_cartesian(ylim=c(0, 0.6)) +
scale_y_continuous(breaks = seq(0,0.5,0.1), labels = seq(0.1,0.6,0.1))
现在您可以通过将
..c(seq(0.3
更改为..c(seq(0.4
等来单独更改stat_compare_means
的位置。最后,您可以将两个图与
中的ggpubr
包ggarrange
结合起来
试试这个。它适用于任何数量的基因。无硬编码:
library(rstatix)
sort_order <- c(
"Hd_Lin+", "Hd_Lin-",
"Ab_Lin+", "Ab_Lin-",
"Bc_Lin+", "Bc_Lin-",
"Tl_Lin+", "Tl_Lin-"
)
my_comparisons <- list(
c("Hd_Lin+", "Hd_Lin-"),
c("Ab_Lin+", "Ab_Lin-"),
c("Bc_Lin+", "Bc_Lin-"),
c("Tl_Lin+", "Tl_Lin-")
)
dat <- dat %>%
mutate(GROUP = factor(GROUP, levels = sort_order))
stat.test <- dat %>%
group_by(genes) %>%
t_test(gexp ~ GROUP, p.adjust.method = "none") %>%
add_xy_position(x = "GROUP", fun = "mean_se",
scales = "free", comparisons = my_comparisons, step.increase = 0) %>%
mutate(p.adj.signif = if_else(p.adj.signif == "", "NS.", p.adj.signif))
p <- ggpubr::ggbarplot(dat, x = "GROUP", y = "gexp", add = "mean_se",
facet = "genes", scales = "free"
) +
stat_pvalue_manual(stat.test, hide.ns = FALSE, tip.length = 0, bracket.nudge.y = 0.01) +
# scale_y_continuous(expand = expansion(mult = c(0.05, 0.5))) +
theme(strip.text.x = element_text(size = 20, colour = "black", face = "bold")) +
theme(legend.position = "none") +
xlab("") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
p
它产生: