I am trying to add p-values to each boxplot pair in the graph shown below. I would like the p-values to be placed under each soil horizon label ('O', 'A' and 'B').
My data looks like this:
> head(kiwi_l)
# A tibble: 6 x 6
type horizon root_name length diameter n_child
<chr> <chr> <chr> <dbl> <dbl> <int>
1 Elevated CO2 A R1_A_L_S4G 0.0752 0.0342 0
2 Elevated CO2 A R1_A_L_S4F 0.0987 0.0319 0
3 Elevated CO2 A R1_A_L_S4E 0.105 0.0209 0
4 Elevated CO2 A R1_A_L_S4D 0.0476 0.0127 0
5 Elevated CO2 A R1_A_L_S4C 0.110 0.0282 0
6 Elevated CO2 A R1_A_L_S4B 0.244 0.0168 0
While the code I used to generate the graph is:
l_horizon<-ggplot(kiwi, aes(x=type, y=length, fill=type, palette='jco'))
+
geom_boxplot() +
facet_grid(. ~ factor(horizon, level=level_order)) +
theme_pubr() +
scale_y_continuous(name='Primary root length (cm)') +
scale_x_discrete(name='Treatment') +
ggtitle('Soil horizon') + theme(plot.title = element_text(hjust = 0.5)) +
theme(legend.position="none") +
theme(plot.title = element_text(size = 10, face = "bold"),
text = element_text(size = 10),
axis.title = element_text(face="bold"),
axis.text.x=element_text(size = 10),
axis.text.y=element_text(size=10),
axis.title.x = element_blank(),
axis.title.y=element_text(size=10))
l_horizon<-l_horizon+scale_fill_locuszoom()
l_horizon
Please help!