title: Plot histogram of epoch list, x axis by month-year in PyPlot
body: <p>With a list of epoch dates, is there a parameter in <code>pyplot</code> or <code>numpy</code> to have an histogram where the <code>bins</code> match the months in the <code>data</code> list? In this example, the list correspond to random date from 2012 to 2013. I would like that the histogram shows the bars from, for example, February 2012 to October 2013 if the values in <code>data</code> correspond only to dates from these months.</p>
  
  <p>This code makes an histogram, but it separates manually for <code>bins=24</code>.</p>
  
  <pre><code>import numpy as np
  import matplotlib.mlab as mlab
  import matplotlib.pyplot as plt
  import matplotlib.dates as mdates
  import random
  
  data = [int(random.randint(1293836400, 1356994800)) for _ in range(1000)]
  
  # convert the epoch format to matplotlib date format
  mpl_data = mdates.epoch2num(data)
  
  fig, ax = plt.subplots(1,1)
  ax.hist(mpl_data, bins=24, ec='black')
  ax.xaxis.set_major_locator(mdates.MonthLocator())
  ax.xaxis.set_major_formatter(mdates.DateFormatter('%d.%m.%y'))
  fig.autofmt_xdate()
  plt.show()
  </code></pre>