title: python - change x axis using data frame column
body: <p>I have a data frame, <code>df</code> I used to produce a plot of two series like so:</p>
  
  <pre><code>year = [2002, 2002, 2002, 2002]
  month = ['Jan', 'Feb', 'Mar', 'Apr']
  column1 = [3.3, 3.0, 3.1, 3.2, 2.9]
  column2 = [7.0, 7.1, 7.3, 6.9, 7.3]
  Dataset = list(zip(year, month, column1, column2))
  df = DataFrame(data = Dataset, columns = ['year', 'month', 'column1', 'column2'])
  df['column1'].plot(legend = True, label = 'column1')
  df['column2'].plot(legend = True, label = 'column2', title = \
  "Figure 1", style = '--', linewidth = 2.5)
  </code></pre>
  
  <p>Which produces the following:</p>
  
  <p><a href="https://i.stack.imgur.com/iyGkM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iyGkM.png" alt="enter image description here"></a></p>
  
  <p>I also have a column in my dataframe, <code>df['year']</code> that has values that I would like to go along the x-axis.  I tried the following</p>
  
  <pre><code>plt.xticks(df['year'])
  </code></pre>
  
  <p>But the following happened:</p>
  
  <p><a href="https://i.stack.imgur.com/gmWXc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gmWXc.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to use the column <code>df['year']</code> and have its values as the x axis tick marks without manually listing them?  I would like the final version to look like the first plot but with the unique values of <code>df['year']</code> along the x-axis. </p>