title: ggplot - From numerical to categorical x-
body: <p>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.</p>
  
  <p>This is my original data:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>TLR3 and TLR4 hold the values for the additional points I want to plot.</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>The above gives me the plot I need, but except I need to offset the points on 3 for FG and 1 for ST.</p>
  
  <p><a href="https://i.stack.imgur.com/ax0Uj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ax0Uj.png" alt="enter image description here"></a></p>
  
  <p>I changed my dataset to this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Which offsets the points perfectly, but I am not sure how to get the old categories back on the x-axis?</p>
  
  <p>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.</p>
  
  <p><a href="https://i.stack.imgur.com/D6HNj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D6HNj.png" alt="enter image description here"></a></p>