title: How to make the error bars move with the barplot when re-ordering factors?
body: <p>I am plotting a barplot with error bars. And here's what I got so far. The problem is that the error bars do not appear in the place where they should be. If I don't force the ID levels, by removing the <code>df2ID &lt;- factor(df2$ID, level = c('Gary','Jack', 'Alice'))</code> line, everything looks fine.  </p>
  
  <pre><code>ID = c(rep('Gary',10), rep('Jack',10), rep('Alice',10))
  #Gary has lowest mean and sd, Alice has highest mean and sd
  var1 = c(rnorm(1:10)*1+10,rnorm(1:10)*10+20, rnorm(1:10)*100+30)  
  df &lt;-data.frame(ID = ID, var1 = var1)
  df2 &lt;- ddply(df, 'ID', summarise, mean = mean(var1), sd = sd(var1))
  df2$ID &lt;- factor(df2$ID, level = c('Gary','Jack', 'Alice'))
  limits &lt;- aes(ymax = df2$mean + df2$sd, ymin = df2$mean - df2$sd)
  ggplot(df2, aes(y=mean, x=ID))+geom_bar(stat='identity')+
    geom_errorbar(limits)+
    facet_grid(.~ID)
  </code></pre>
  
  <p>But I do need to keep that line so I can re-order the sequence of the panels. How can I make the error bars re-ordered too?</p>