title: Matplotlib- make x-ticks the first time of the month on contourf plot
body: <p><strong>The issue</strong></p>
  
  <p>I have a filled contour plot and some time series data with time on the x-axis and height on the y-axis. I made a datetime list and can substitute that in for the x-axis ticks in place of the default list of numbers that usually gets used as x-ticks instead. That's fine and all, but I'd like the xticks to be plotted on the first of each month instead of every 30 days. I know there's a MonthLocator function in mpl.dates, but I can't figure out how it to use it correctly. All the examples I'm finding use line plots, not contourf, and the axes work differently between both.</p>
  
  <p><strong>Working example</strong></p>
  
  <pre><code>#Modules
  
  import numpy             as     np
  import datetime          as     dt
  import matplotlib.pyplot as     plt
  from   matplotlib        import ticker
  %matplotlib inline
  
  #Data
  data = np.random.randint(0,50,(10,61))
  print(data.shape)
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>(10, 61)
  </code></pre>
  
  <pre><code>#Dates
  dates = []
  base = dt.datetime(2000,1,1,1)
  for i in range(len(data[1])):
      date      = base + dt.timedelta(days=i)
      dates.append(str(date.strftime("%-m/%-d/%-Y")))
  print(dates[0], dates[-1])
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>('1/1/2000', '3/1/2000')
  </code></pre>
  
  <pre><code>#Levels
  levels = np.arange(1,len(data[1])+1)
  clevels = np.arange(0,50,5)
  
  #Figure
  fig, ax = plt.subplots(figsize=(10, 5))
  im      = ax.contourf(data,levels,levels=clevels,cmap='RdBu_r',extend='both')
  
  #Axis customization
  ax.set_xticklabels(dates)
  plt.xticks(np.arange(len(dates))[::30],dates[::30])
  ax.set_ylabel("Level")
  cbar = plt.colorbar(im,values=clevels,pad=0.01)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xGvpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xGvpm.png" alt="enter image description here"></a></p>
  
  <p><strong>The question</strong></p>
  
  <p>How do I make the x-ticks plot the first day of each month instead of at a set interval?</p>