title: Plotting equal number of points in equal number of bins and averaging bin values
body: <p>I have a list of points. I want to put an equal number of points in an equal number of bins in a histogram. Ideally it would not be hard coded so in the future I could have uneven amounts of points in any number of bins. </p>
  
  <p>Then I want to find the mean for each bin and plot these values on the same graph. </p>
  
  <p>I should end up with either a scatter plot or histogram of the total data with the specific means plotted on top of that. </p>
  
  <p>I found some code to put equal amounts of data into bins. But I am struggling moving forward. </p>
  
  <pre class="lang-py prettyprint-override"><code>data = [list of 1103 points] 
  b = number of bins
  
  def histedges(data, binss):
      n = len(x)
      return np.interp(np.linspace(0, n, binss + 1),
                       np.arange(n),np.sort(data))
  
  n, bins, patches = plt.hist(dis, histedges(data, b))
  </code></pre>