title: Plot histogram of a large number of integers using matplotlib
body: <p>I am trying to plot the frequency of integers in a <em>large</em> list of number in a <em>large</em> range. More specifically:</p>
  
  <pre><code>ints = np.random.random_integers(0,1440,15000)
  </code></pre>
  
  <p><code>ints</code> is a long list of integers with values between 0 and 1440. Next I want to plot a histogram that will visualize the frequencies. To that end, I use something like:</p>
  
  <pre><code>fig_per_hour = plt.figure()
  per_hour = fig_per_hour.add_subplot(111)
  counts, bins, patches = per_hour.hist(
      ints, bins = np.arange(0,1441), normed = False, color = 'g',linewidth=0)
  plt.show()
  </code></pre>
  
  <p>But I face two problems:</p>
  
  <ol>
  <li>An annoying gap at the right end of the x-axis. Although I specify the right(?) amount of bins, the plot doesn't reflect it.</li>
  <li>Due to the large range from which the ints are sampled, each bar is very thin, and hard to distinct. Is it possible to stretch the x-axis so the bars will be wider? The reason is that I want to annotate the x-axis and some of the bars.</li>
  </ol>
  
  <p>For reference, here's the output I have so far:
  <img src="https://i.stack.imgur.com/o2Njy.png" alt="enter image description here"></p>