当前位置:网站首页>How to Add P-Values onto Horizontal GGPLOTS
How to Add P-Values onto Horizontal GGPLOTS
2022-07-02 09:41:00 【小宇2022】
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
stat.test <- df %>% t_test(len ~ dose)
# Box plot
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp + stat_pvalue_manual(stat.test, label = "p.adj.signif", tip.length = 0.01)
# Bar plot
stat.test <- stat.test %>% add_xy_position(fun = "mean_sd", x = "dose")
bp + stat_pvalue_manual(stat.test, label = "p.adj.signif", tip.length = 0.01)
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(
stat.test, label = "p.adj.signif", tip.length = 0.01,
coord.flip = TRUE
) +
coord_flip()
# Horizontal bar plot with p-values
stat.test <- stat.test %>% add_xy_position(fun = "mean_sd", x = "dose")
bp + stat_pvalue_manual(
stat.test, label = "p.adj.signif", tip.length = 0.01,
coord.flip = TRUE
) +
coord_flip()
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Using `p.adj` as labels
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(
stat.test, label = "p.adj", tip.length = 0.01,
coord.flip = TRUE
) +
coord_flip()
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
stat.test <- df %>% t_test(len ~ dose, ref.group = "0.5")
# Vertical box plot with p-values
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(stat.test, label = "p.adj", tip.length = 0.01) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
stat.test <- df %>% t_test(len ~ dose, ref.group = "0.5")
# Vertical box plot with p-values
# Vertical bar plot with p-values
stat.test <- stat.test %>% add_xy_position(fun = "mean_sd", x = "dose")
bp +
stat_pvalue_manual(stat.test, label = "p.adj.signif", tip.length = 0.01) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Horizontal box plot with p-values
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(
stat.test, label = "p.adj", tip.length = 0.01,
coord.flip = TRUE
) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1))) +
coord_flip()
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Horizontal bar plot with p-values
stat.test <- stat.test %>% add_xy_position(fun = "mean_sd", x = "dose")
bp +
stat_pvalue_manual(
stat.test, label = "p.adj", tip.length = 0.01,
coord.flip = TRUE
) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1))) +
coord_flip()
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Show p-values at x = "group2"
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(
stat.test, label = "p = {p.adj}", tip.length = 0.01,
coord.flip = TRUE, x = "group2", hjust = 0.4
) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.2))) +
coord_flip()
library(ggpubr)
library(rstatix)
# Transform `dose` into factor variable
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df, 3)
# Box plots
bxp <- ggboxplot(df, x = "dose", y = "len", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Bar plots showing mean +/- SD
bp <- ggbarplot(df, x = "dose", y = "len", add = "mean_sd", fill = "dose",
palette = c("#00AFBB", "#E7B800", "#FC4E07"))
# Make the p-values horizontal using the option angle
stat.test <- stat.test %>% add_xy_position(x = "dose")
bxp +
stat_pvalue_manual(
stat.test, label = "p = {p.adj}", tip.length = 0.01,
coord.flip = TRUE, x = "group2", angle = 90
) +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1))) +
scale_x_discrete(expand = expansion(mult = c(0.05, 0.3))) +
coord_flip()
边栏推荐
- Always report errors when connecting to MySQL database
- ASTParser 解析含有emum 枚举方法的类文件的踩坑记
- Complement (Mathematical Simulation
- 【多线程】主线程等待子线程执行完毕在执行并获取执行结果的方式记录(有注解代码无坑)
- MySql存储过程游标遍历结果集
- 每月1号开始计算当月工作日
- webauthn——官方开发文档
- II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation
- GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
- ren域名有价值吗?值不值得投资?ren域名的应用范围有哪些?
猜你喜欢
Basic usage of MySQL in centos8
Always report errors when connecting to MySQL database
Eight sorting summaries
由粒子加速器产生的反中子形成的白洞
微信小程序利用百度api达成植物识别
Seriation in R: How to Optimally Order Objects in a Data Matrice
How to Visualize Missing Data in R using a Heatmap
GGPlot Examples Best Reference
可升级合约的原理-DelegateCall
On April 17, 2022, the five heart matchmaker team received double good news
随机推荐
Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?
Introduction to interface debugging tools
Complement (Mathematical Simulation
Resources reads 2D texture and converts it to PNG format
String (Analog
基于 Openzeppelin 的可升级合约解决方案的注意事项
Never forget, there will be echoes | hanging mirror sincerely invites you to participate in the opensca user award research
Multi line display and single line display of tqdm
Principle of scalable contract delegatecall
Liftover for genome coordinate conversion
Skills of PLC recorder in quickly monitoring multiple PLC bits
微信小程序利用百度api达成植物识别
Writing contract test cases based on hardhat
数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
Attribute acquisition method and operation notes of C # multidimensional array
map集合赋值到数据库
mysql 基本语句
Seriation in R: How to Optimally Order Objects in a Data Matrice
Homer预测motif
Astparser parsing class files with enum enumeration methods