title: How to plot result of np.histogram with matplotlib analog to plt.hist
body: <p>I like to plot my histograms like this:</p>
  
  <pre><code>data = [-0.5, 0.5, 0.5, 0.5, 
      1.5, 2.1, 2.2, 2.3, 2.4, 2.5, 3.1, 3.2]
  
  plt.hist(data, bins=5, range=[-1, 4], histtype='step')
  </code></pre>
  
  <p>Now, when I have somehow large input data (larger than my memory), I need to fill the histogram chunk by chunk. E.g. like this:</p>
  
  <pre><code>H, bins = np.histogram([], bins=5, range=[-1, 4])
  for data in a_lot_of_input_files:
      H += np.histogram(data, bins=5, range=[-1, 4])[0]
  </code></pre>
  
  <p>But the question is always, "How do I plot this <code>H</code> again, so it looks just like the previous matplotlib version.</p>
  
  <p>The solution I came up with, looks like this:</p>
  
  <pre><code>plt.plot(bins, np.insert(H, 0, H[0]), '-', drawstyle='steps')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/2FBDa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2FBDa.png" alt="Two different versions of plotting a histogram."></a></p>
  
  <p>However, neither looks the result identical, nor does it feel very nice to create a copy of <code>H</code> for plotting it. </p>
  
  <p>Is there some elegant solution I am missing? (I did not yet try to use <code>plt.bar</code>, because the bar-graphs don't work nicely, when one wants to compare histograms)</p>