title: How to change the line thickness of whiskers using stat_boxplot(geom = "errorbar")
body: <p>I would like to change the line thickness of the whiskers when using <code>stat_boxplot(geom = "errorbar")</code>:</p>
  
  <pre><code>set.seed(42)
  df &lt;- data.frame(cond = factor( rep(c("A","B"), each=500) ), 
    value = c(rnorm(500,mean=1,sd=0.2),rnorm(500, mean=1.5,sd=0.1)))
  ggplot(df, aes(x=cond, y=value)) + geom_boxplot(lwd=0.2)
  ggplot(df, aes(x=cond, y=value)) + 
        stat_boxplot(geom = "errorbar", 
         stat_params = list(width = 0.5,size = 5.0)) + 
        geom_boxplot(lwd=0.2)
  </code></pre>
  
  <p>In the second plot <code>lwd=0.2</code> changes the thickness of the lines in the box, but the whiskers remain the same.</p>
  
  <p><a href="https://i.stack.imgur.com/YPyFB.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/YPyFB.jpg" alt="enter image description here"></a>  <a href="https://i.stack.imgur.com/UaNDd.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/UaNDd.jpg" alt="enter image description here"></a></p>
  
  <h2>Update</h2>
  
  <p>Thanks @eipi10,</p>
  
  <pre><code>ggplot(df, aes(x=cond, y=value)) + stat_boxplot(geom = "errorbar",
      width = 0.5, size=0.2) + geom_boxplot(lwd=0.2)
  </code></pre>
  
  <p>your solution changes the thickness of the lines of the whiskers but it makes the horizontal line at their end as wide as the box, instead of half (width = 0.5).</p>
  
  <p>But using</p>
  
  <pre><code>ggplot(df, aes(x=cond, y=value)) + stat_boxplot(geom ="errorbar",
      stat_params = list(width = 0.5), size=0.2) + geom_boxplot(lwd=0.2)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>ggplot(df, aes(x=cond, y=value)) + stat_boxplot(geom = "errorbar",
      stat_params = list(width = 0.5, size=0.2)) + geom_boxplot(lwd=0.2)
  </code></pre>
  
  <p>then the whiskers width is half of the box as intended but their line thickness is the default one that is thicker than the lines of the box.</p>
  
  <p>In other words, I cannot simultaneously change the thickness of the lines and the width of the whiskers.</p>
  
  <h2>Update two</h2>
  
  <p>I am getting the same result with these two pieces of code (both without stat_params)</p>
  
  <pre><code>ggplot(df, aes(x=cond, y=value)) + stat_boxplot(geom = "errorbar",
      width=0.5, size=5) + geom_boxplot(lwd=0.2)
  
  ggplot(df, aes(x=cond, y=value)) + stat_boxplot(geom = "errorbar",
      width=0.2, size=5) + geom_boxplot(lwd=0.2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/zAJ8U.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/zAJ8U.jpg" alt="enter image description here"></a>  <a href="https://i.stack.imgur.com/KBKbO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KBKbO.jpg" alt="enter image description here"></a></p>
  
  <p>Jose</p>