title: Why the data misplaced in the boxplot with errorbar in ggplot2
body: <p>I have a data frame like below,</p>
  <pre><code>
  dat&lt;- structure(list(treat = c(&quot;A&quot;, &quot;CO2&quot;,&quot;A&quot;, &quot;CO2&quot;, &quot;A&quot;, &quot;CO2&quot;, &quot;A&quot;, &quot;CO2&quot;), year = c(&quot;2013&quot;, &quot;2013&quot;, &quot;2020&quot;, &quot;2020&quot;, &quot;2013&quot;, &quot;2013&quot;, &quot;2020&quot;, &quot;2020&quot;), average =c(-27.71561, -28.49894, -28.4279,-29.19103,-27.23562, -34.82991,-27.702, -30.15088), SE =c(0.0498346, 0.0749154, 0.07203569,0.15294481, 0.07090478,0.46597789, 0.1244737,0.2747658), items = c(&quot;soil&quot;, &quot;soil&quot;, &quot;soil&quot;,&quot;soil&quot;,&quot;root&quot;, &quot;root&quot;, &quot;root&quot;, &quot;root&quot;)), row.names = c(NA, -8L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
  
  </code></pre>
  <p>and I want to make a boxplot with an errorbar, but I have no idea why the data is not exactly on the same vertical line as 2013 and 2020.</p>
  <p>My code is like,</p>
  <pre><code>ggplot(dat, aes(x=year, y=average, group= items))+
    stat_boxplot(geom ='errorbar')+ 
    geom_boxplot(aes(fill=items))+
    facet_grid(.~treat) 
  </code></pre>