title: Differing quantiles: Boxplot vs. Violinplot
body: <pre><code>require(ggplot2)
  require(cowplot)
  d = iris
  
  ggplot2::ggplot(d, aes(factor(0), Sepal.Length)) + 
      geom_violin(fill="black", alpha=0.2, draw_quantiles = c(0.25, 0.5, 0.75)
                  , colour = "red", size = 1.5) +
      stat_boxplot(geom ='errorbar', width = 0.1)+
      geom_boxplot(width = 0.2)+
      facet_grid(. ~ Species, scales = "free_x") +
      xlab("") + 
      ylab (expression(paste("Value"))) +
      coord_cartesian(ylim = c(3.5,9.5)) + 
      scale_y_continuous(breaks = seq(4, 9, 1)) + 
      theme(axis.text.x=element_blank(),
            axis.text.y = element_text(size = rel(1.5)),
            axis.ticks.x = element_blank(),
            strip.background=element_rect(fill="black"),
            strip.text=element_text(color="white", face="bold"),
            legend.position = "none") +
      background_grid(major = "xy", minor = "none") 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cJItC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cJItC.png" alt="boxplot vs. violinplot"></a></p>
  
  <p>To my knowledge box ends in boxplots represent the 25% and 75% quantile, respectively, and the median = 50%. So they should be equal to the 0.25/0.5/0.75 quantiles which are drawn by <code>geom_violin</code> in the <code>draw_quantiles = c(0.25, 0.5, 0.75)</code> argument. </p>
  
  <p>Median and 50% quantile fit. However, both 0.25 and 0.75 quantile do not fit the box ends of the boxplot (see figure, especially 'virginica' facet). </p>
  
  <p>References: </p>
  
  <ol>
  <li><p><a href="http://docs.ggplot2.org/current/geom_violin.html" rel="noreferrer">http://docs.ggplot2.org/current/geom_violin.html</a></p></li>
  <li><p><a href="http://docs.ggplot2.org/current/geom_boxplot.html" rel="noreferrer">http://docs.ggplot2.org/current/geom_boxplot.html</a></p></li>
  </ol>