title: Categorical scatter plot with mean segments using ggplot2 in R
body: <p>I am trying to plot a simple scatter plot for 3 groups, overlaying a segment indicating the mean for each group and labelling the groups. 
  I have managed to get a scatter plot with error bars, but I would only like a segment indicating where the mean is. I also cannot seem to be getting the group labelling right. </p>
  
  <p>To get the summary statistics I am using the function "summarySE" from <a href="http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_%28ggplot2%29/" rel="nofollow noreferrer">this page</a>. [EDIT: note this function is also provided in the Rmisc package]</p>
  
  <p>Is there any simpler way to do this, and to get a segment instead of a point for the mean?</p>
  
  <p>I really appreciate your help!</p>
  
  <pre><code>library(ggplot2)
  library(plyr)
  
  df &lt;- data.frame(tt = rep(1:3, each = 40),
         val = round(rnorm(120, m = rep(c(4, 5, 7), each = 40))))
  
  # After loading the summarySE function:
  
  dfc &lt;- summarySE(df, measurevar="val", groupvars="tt")
  
  
  ggplot(dfc, aes(tt, val), main="Scatter plot with mean bars", 
        xlab="Groups", ylab="Values", names=c("Group1", "Group2", "Group3"))+
    geom_jitter(aes(tt, val), data = df, colour = I("red"), 
                 position = position_jitter(width = 0.05)) +
    geom_point(size = 3) +
    geom_errorbar(aes(ymin=val-sd, ymax=val+sd), width = 0.01, size = 1)
  </code></pre>