I have a data frame, df I used to produce a plot of two series like so:
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)
Which produces the following:
I also have a column in my dataframe, df['year'] that has values that I would like to go along the x-axis. I tried the following
plt.xticks(df['year'])
But the following happened:
Is there a way to use the column df['year'] 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 df['year'] along the x-axis.



