I need some help to combine four individual plots on a single page (single plot). I draw four different plots using the same codes but with different data groups. I need to draw all four plots on a single page.
library(ggpubr)
library(rstatix)
library(xlsx)
df<-read.xlsx("umar.xlsx", header = T, 1)
# Statistical test
######## Figure 1 ########
stat.test <- df %>%
t_test(Moisture_content ~ substrate) %>%
add_significance()
stat.test
# Box plots with p-values
bxp <- ggboxplot(df, x = "substrate", y = "Moisture_content", fill = "substrate",
palette = c("#00AFBB", "#E7B800"), width = 0.35)
stat.test <- stat.test %>% add_xy_position(x = "substrate")
bxp +
stat_pvalue_manual(stat.test, label = "p = {p}") +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
theme(
aspect.ratio = 3
)
######## Figure 2 ########
stat.test <- df %>%
t_test(pH ~ substrate) %>%
add_significance()
stat.test
# Box plots with p-values
bxp <- ggboxplot(df, x = "substrate", y = "pH", fill = "substrate",
palette = c("#00AFBB", "#E7B800"), width = 0.35)
stat.test <- stat.test %>% add_xy_position(x = "substrate")
bxp +
stat_pvalue_manual(stat.test, label = "p = {p}") +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
theme(
aspect.ratio = 3
)
######## Figure 3 ########
stat.test <- df %>%
t_test(EC ~ substrate) %>%
add_significance()
stat.test
# Box plots with p-values
bxp <- ggboxplot(df, x = "substrate", y = "EC", fill = "substrate",
palette = c("#00AFBB", "#E7B800"), width = 0.35)
stat.test <- stat.test %>% add_xy_position(x = "substrate")
bxp +
stat_pvalue_manual(stat.test, label = "p = {p}") +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
theme(
aspect.ratio = 3
)
######## Figure 4 ########
stat.test <- df %>%
t_test(Moisture_content ~ substrate) %>%
add_significance()
stat.test
# Box plots with p-values
bxp <- ggboxplot(df, x = "substrate", y = "Moisture_content", fill = "substrate",
palette = c("#00AFBB", "#E7B800"), width = 0.35)
stat.test <- stat.test %>% add_xy_position(x = "substrate")
bxp +
stat_pvalue_manual(stat.test, label = "p = {p}") +
scale_y_continuous(expand = expansion(mult = c(0.05, 0.1)))+
theme(
aspect.ratio = 3
)