title: Set matplotlib grid ticks based on specific dates
body: <p>I am plotting Pandas Series datetimes of 30 years. The x-axis are dates:</p>
  
  <pre><code>Datetime
  1965-06-08    3545
  1965-06-09    6378 
  1965-06-10    9857
  1965-06-11    2528
  ....
  Freq: W-SUN, dtype: int64
  </code></pre>
  
  <p>I would like to have a "minor tick" at each month, and a "major tick" at each year. </p>
  
  <p>Because this is thirty years of data, manually placing ticks will not work. </p>
  
  <p>Based on matplotlib's API for dates, <a href="http://matplotlib.org/api/dates_api.html" rel="nofollow noreferrer">http://matplotlib.org/api/dates_api.html</a></p>
  
  <p>is it possible to set a tick at each month? </p>
  
  <p>If I were to manually set up a grid, I would do something like this:</p>
  
  <pre><code>import numpy as np                                                               
  import matplotlib.pyplot as plt                                                                                                                                 
  fig = plt.figure()                                                               
  ax = fig.add_subplot(1,1,1)                                                      
  
  # This is where I manually set ticks. Can I use Datetime data instead???                                     
  major_ticks = np.arange(0, 101, 20)                                              
  minor_ticks = np.arange(0, 101, 5)                                               
  
  ax.set_xticks(major_ticks)                                                       
  ax.set_xticks(minor_ticks, minor=True)                                           
  ax.set_yticks(major_ticks)                                                       
  ax.set_yticks(minor_ticks, minor=True)                                           
  ax.grid(which='both')                                                                                           
  ax.grid(which='minor', alpha=0.3)                                                
  ax.grid(which='major', alpha=0.4)                                                
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/vNTaP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vNTaP.png" alt="enter image description here"></a></p>