I'm working with a nested boxplot comparing observed landtypes and simulated land types. I want to show the means of each data set as a line (not a point) within the box of each boxplot.
To erase the median lines, and input the means as an "errorbar" I used the code:
No.Forest.Plot <- ggplot(data = NoForest_Long,
aes(x= value, y = variable, fill = ObsSim)) +
labs(x= "Percent of Cover", y= "Land Type Categories") +
ggtitle( "Observed vs. Simulated Land Categories (No Forest)") +
geom_boxplot(fatten = NULL) +
stat_summary(fun = mean, fun.min = mean,
fun.max = mean, geom = "errorbar", width = 0.5,)
Which provides this plot. Unfortunately, the lines are centered on each category as opposed to the boxes themselves.
How do I get the means of both the "observed" and "simulated" to be centered in their respective boxes?