I can't seem to get geom_path to connect dodged points within a facet_wrap with grouped variables. The path lines remain vertical instead of connecting observations. I want to keep the points dodged as a way to show time trajectory within a treatment. Example data and ggplot script below.
df <- data.frame (Treatment = c("Drill_Herb", "Drill_Herb", "Drill_None", "Drill_None", "Herb_None","Herb_None", "Herb_Drill", "Herb_Drill"),
Comparison_Combo = c("Drill_Herb_TO_Drill_None", "Drill_Herb_TO_Drill_None", "Herb_None_TO_Herb_Drill", "Herb_None_TO_Herb_Drill"),
Ratio = sample(1:8, 8, replace=FALSE),
Year = c("2017", "2021","2017", "2021","2017", "2021","2017", "2021"))
ggplot(df, aes(x=Treatment, y=Ratio, shape=str_wrap(Year,25),
linetype=str_wrap(Treatment))) +
facet_wrap(~Comparison_Combo, drop = TRUE, scales = "free_x", nrow = 1) +
geom_point(size=3.5, position=position_dodge(width=0.55))+
geom_path(aes(group=Treatment), lwd=1,
position=position_dodge(width=0.55))
Output: