I need to make a plot of three mean values +- SE, and the add some additional points to this plot. The y-axis is numerical and the x-axis should be categorical. Some of the additional points have the same y-value within the same category, so to get the point offset, so they did not cover each other, I changed my categories to values 5,10,15, and then gave the two points overlapping for 5 the x-values of 4.9 and 5.1. This works perfect - but now I need to have the categories show on the x-axis.
This is my original data:
Island;Armean;SE;TLR3;TLR4
ST;4,166666667;0,477;1;1
FG;3,666666667;0,715;3;3
SN;1,666666667;0,333;3;2
TLR3 and TLR4 hold the values for the additional points I want to plot.
qplot(df$Island, df$Armean) + geom_errorbar(aes(x=df$Island, ymin=df$Armean-df$SE, ymax = df$Armean+df$SE), width = 0.25) + geom_point(aes(y=df$TLR3), color ="red") + geom_point(aes(y=df$TLR4), color ="blue") + theme_bw()
The above gives me the plot I need, but except I need to offset the points on 3 for FG and 1 for ST.
I changed my dataset to this:
Island;Armean;SE;TLR3;TLR4
5;4,166666667;0,477;NA;NA
10;3,666666667;0,715;NA;NA
15;1,666666667;0,333;3;2
4,92;NA;NA;1;NA
5,08;NA;NA;NA;1
9,92;NA;NA;3;NA
10,08;NA;NA;NA;3
Which offsets the points perfectly, but I am not sure how to get the old categories back on the x-axis?
I could use jitter instead of the above, but I wish the points to have the same distance to the center line, and only the point that overlap to be offset.