title: How to change the step size matplotlib uses when plotting timestamp objects?
body: <p>I'm currently attempting to graph a fairly small dataset using the matplotlib and pandas libraries. The format of the dataset is a CSV file. Here is the dataset:</p>
  
  <pre><code>DATE,UNRATE
  1948-01-01,3.4
  1948-02-01,3.8
  1948-03-01,4.0
  1948-04-01,3.9
  1948-05-01,3.5
  1948-06-01,3.6
  1948-07-01,3.6
  1948-08-01,3.9
  1948-09-01,3.8
  1948-10-01,3.7
  1948-11-01,3.8
  1948-12-01,4.0
  </code></pre>
  
  <p>I loaded the dataset using pandas (as can be seen, the file that holds that dataset is named 'dataset.csv'):</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import pandas as pd
  
  dataset = pd.read_csv('dataset.csv')
  dataset['DATE'] = pd.to_datetime(dataset['DATE'])
  </code></pre>
  
  <p>I then attempted to plot the dataset loaded, using matplotlib:</p>
  
  <pre><code>plt.plot(dataset['DATE'], dataset['UNRATE'])
  plt.show()
  </code></pre>
  
  <p>The code above mostly worked fine, and displayed the following graph:</p>
  
  <p><a href="https://i.stack.imgur.com/ncaqd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ncaqd.png" alt="enter image description here"></a></p>
  
  <p>The problem, however, is that <em>the data I wanted displayed on the x axis, seems to have only been plotted in intervals of two</em>:</p>
  
  <p><a href="https://i.stack.imgur.com/T7HEG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T7HEG.jpg" alt="enter image description here"></a></p>
  
  <p>I found the question, <a href="https://stackoverflow.com/questions/12608788/changing-the-tick-frequency-on-x-or-y-axis-in-matplotlib"><em>Changing the “tick frequency” on x or y axis in matplotlib?</em></a>, which does correlate to my problem. But, from my testing, only seems to work with <em>integral values</em>.</p>
  
  <p>I also found the question, <a href="https://stackoverflow.com/questions/40188264/controlling-the-number-of-x-ticks-in-pyplot"><em>controlling the number of x ticks in pyplot</em></a>, which seemed to provide a solution to my problem. The method the answer said to use, <code>to_pydatetime</code>, was a method of <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DatetimeIndex.html" rel="nofollow noreferrer"><code>DatetimeIndex</code></a>. Since my understanding is that <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html#pandas-to-datetime" rel="nofollow noreferrer"><code>pandas.to_datetime</code></a> would return a <code>DatetimeIndex</code> by default, I could use <code>to_pydatetime</code> on <code>dataset['DATE']</code>:</p>
  
  <pre><code>plt.xticks(dataset['DATE'].to_pydatetime())
  </code></pre>
  
  <p>However, I instead received the error:</p>
  
  <pre><code>AttributeError: 'Series' object has no attribute 'to_pydatetime'
  </code></pre>
  
  <p>Since this appears to just be default behavior, is there a way to force matplotlib to graph each point along the x axis, rather than simply graphing every other point?</p>