I like to learn how to reproduce this plot. I dont know what this is called but I am interested to recreate this using this dataset where X is a my predictor variable and M1 is my grouping variable.
So the Fladen = a, Landsort=b, Utlagan=c, etc
TM, RC, S2, S1, MM will be Level = 1, 2,3,4
effect_data <- data.frame( Level = factor(rep(1:4, each = 12)), # Assuming 12 sets of analyses EffectEstimate = runif(48, min = -2, max = 2), # Replace with your actual effect estimates LowerCI = runif(48, min = -3, max = -1), # Replace with your actual lower CIs UpperCI = runif(48, min = 1, max = 3), # Replace with your actual upper CIs M1 = factor(rep(letters[1:12], times = 4)) )
Expecting a plot like this. Thanks in advance for any help.
This is a so called dot and whisker plot:
library(ggplot2) ggplot(effect_data, aes(y = Level, x = EffectEstimate)) + geom_errorbarh(aes(xmin = LowerCI, xmax = UpperCI), height = 0, #removing ticks position = position_dodge(width = 0.3), color = "gray", alpha = 0.5, size = 3) + geom_point(color = "black", size = 3, position = position_dodge(width = 0.3)) + facet_wrap(~ M1, scales = "free_y", ncol = 4) + labs(title = "Effect Estimates with 95% CI", y = "Effect Estimate", x = "Level") + theme_minimal() + theme( legend.position = "none", strip.background = element_rect(fill="gray", color="black"), strip.text = element_text(size=14, color="black"), panel.border = element_rect(color = "black", fill = NA, linewidth = 1.5) )