I know that there are many questions already open to add significance level in ggplot2 in faceted plots. However, as a R beginner, I did not found a solution for my plot. My data (.txt file) is available in this link:
1drv.ms/t/s!AsLAxDXdkA9Mg8oXdJ-qxD5AeB4KAw
There are four columns: three factor levels (temperature, parasitoid species and behavior) and a numeric level (number of parasitism and host-killing).
I run the plot with the code:
ggplot(mydata, aes(x = temperature, y = value, fill = species)) +
facet_grid(. ~ behavior) +
stat_summary(fun.y = mean, geom = "bar", position = "dodge", stat="identity") +
stat_summary(fun.data = mean_sdl, fun.args = list(mult = 1) +
labs(x = "Temperature", y = "Nº of parasitized or host-killed larvae") +
theme(legend.position = "bottom", legend.title = element_blank(), legend.text = element_text(size = 11, face = "italic"))
Now I want to add the significance level in each plot, comparing separately the results in Parasitism and Host-Killing in both temperatures. So I have 6 contrasts in each plot. I tested the option using the function stat_compare_means. However, as advised in this Rblogger tutorial (https://www.r-bloggers.com/add-p-values-and-significance-levels-to-ggplots/) I should make a list telling what I want to compare. But, in this case, I have two results for 25°C and two for 30°C. How I could create this list mentioning all the contrasts? If anybody could clarify for me how I can solve this, it would help me a lot. Thanks.


