title: Width of error bars in line plot using ggplot2
body: <p>I have some data with standard errors associated and would like to display these with error bars. That's what I have: </p>
  
  <pre><code># generate some data
  hod &lt;- data.frame(h = c(1:24,1:24,1:24), mean = 1:(24*3) + runif(24*3, 0, 5),ci = runif(24*3, 0, 2), t = c(rep("a",24),rep("b",24),rep("c",24)))
  
  pd &lt;- position_dodge(0.3)
    dayplot &lt;- ggplot(hod, aes(x=h, y=mean, colour=as.factor(t),group=as.factor(t))) + 
      geom_line(position=pd, size=1) +
      geom_errorbar(aes(ymin=mean-ci, ymax=mean+ci),
                    width=1,
                    size=0.5,
                    position=pd) +
      geom_point(position=pd, shape=21, size=1, fill="white") +
      scale_x_continuous(limits=c(-0.5,23.5),
                         breaks=c(0:8*3),
                         labels=ifelse(
                                c(0:8*3) &lt; 10,
                                paste('0',c(0:8*3),':00',sep=''),
                                paste(c(0:8*3),':00',sep='')
                                )
                         ) +
      xlab("Hour of day") + ylab(ylabel) + labs(title = varlabels[var]) +
      theme_minimal() + 
      theme(plot.margin = unit(c(1,0,1,1), "cm"), 
            axis.title.x = element_text(vjust=-1),
            axis.title.y = element_text(angle=90, vjust=0),
            legend.margin = unit(c(0), "cm"),
            legend.key.height = unit(c(0.9), "cm"),
            panel.grid.major = element_line(colour=rgb(0.87,0.87,0.87)),
            panel.grid.minor = element_blank(),
            plot.background = element_rect(fill = rgb(0.97,0.97,0.97), linetype=0)
      )
  </code></pre>
  
  <p>The only thing of interest is probably:</p>
  
  <pre><code>geom_errorbar(aes(ymin=mean-ci, ymax=mean+ci),
                        width=1,
                        size=0.5,
                        position=pd)
  </code></pre>
  
  <p>It gives:  <img src="https://i.stack.imgur.com/4M6sY.png" alt="all"></p>
  
  <p>Now when I group the data by a factor variable (<code>as.factor(t)</code>), I get several lines instead of one, which is what I want, BUT, as you can see, the horizontal lines at the error bars are more narrow, and I can't figure out why. I tried changing and even taking away the <code>width</code> and <code>size</code> attribute of <code>geom_errorbar</code>, but nothing happens. Is there a way to have the same width of the horizontal lines for every chart, no matter the data? I mean, why should it vary? Or does that width convey some information? </p>
  
  <p><img src="https://i.stack.imgur.com/YdOdg.png" alt="enter image description here"></p>