title: Getting horizontal lines for summaries in ggplot with stat_summary_bin
body: <p>I would like to take a ggplot scatterplot and overlay on top of it the mean of the y-variable within evenly-spaced bins on the x-axis. </p>
  
  <p>So far what I have is this:</p>
  
  <pre><code>library(tidyverse)
  data(midwest)
  ggplot(arrange(midwest,percollege),aes(x=percollege,y=percbelowpoverty))+
      geom_point()+ 
      stat_summary_bin(aes(x=percollege,y=percbelowpoverty),
          bins=10,fun.y='mean',geom='point',col='red')
  </code></pre>
  
  <p>Which produces
  <a href="https://i.stack.imgur.com/VeocZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VeocZ.png" alt="enter image description here"></a></p>
  
  <p>which is basically perfect except instead of red points I would like horizontal red lines that extend from the beginning of the bin to the end of the bin.</p>
  
  <p>I can sort of mimic what I want with</p>
  
  <pre><code>library(tidyverse)
  data(midwest)
  ggplot(arrange(midwest,percollege),aes(x=percollege,y=percbelowpoverty))+
      geom_point()+ 
      stat_summary_bin(aes(x=percollege,y=percbelowpoverty),
          bins=10,fun.y='mean',geom='point',col='red',shape="-",size=50)
  </code></pre>
  
  <p>which gives </p>
  
  <p><a href="https://i.stack.imgur.com/fXyw9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fXyw9.png" alt="enter image description here"></a></p>
  
  <p>Which is kinda what I want, except</p>
  
  <ol>
  <li>I have to manually set the size every time I make a new graph like this</li>
  <li>Uh, ew.</li>
  </ol>
  
  <p>Another approach I've tried is with <code>geom='bar',fill=NA</code>, which seems promising if I can somehow get it to only show the top bar without the sides or bottom of the bar.</p>
  
  <p>Any tips for this? I've had little luck with setting the geom to <code>pointrange</code> or <code>linerange</code> or <code>line</code> (the first two I've yet to get to work, and the last just connects each point with non-horizontal lines). Kind of surprised this isn't default behavior for <code>stat_summary_bin</code> to be honest!</p>
  
  <p>Thanks!</p>