title: Numpy histogram data: Why is the length of bins vector longer than the histogram values vector?
body: <p>There are two outputs to <code>numpy.histogram</code>:</p>
  <ul>
  <li><code>hist</code>: values of the histogram</li>
  <li><code>bin_edges</code>: Return the bin edges <code>(length(hist)+1)</code></li>
  </ul>
  <p>both are vectors but in the example below, the second vector is of length 101, which is 1 higher than the first vector, which is length 100 :</p>
  <pre><code>import numpy as np
  from numpy.random import rand, randn
  
  n = 100  # number of bins
  X = randn(n)*.1
  a,bins1 = np.histogram(X,bins=n)
  </code></pre>
  <p>The following shape error occurs if I then try <code>plt.plot(bins1,a)</code>:</p>
  <blockquote>
  <p><code>ValueError: x and y must have same first dimension, but have shapes (101,) and (100,)</code></p>
  </blockquote>
  <p>Why, and how do I fix the inequal shape error so I can plot the histogram?</p>