Reputation: 80
plt.figure(figsize=(15,5))
plt.plot(data['Unemployment Rate'])
plt.axis([1948,2017,0,15])
plt.show()
These code returned an empty graph.
The table contains 2 columns, data['Year'] and data['Unemployment Rate'].
The year is between 1948 and 2017.
What I am trying to accomplish is to generate a graph for the unemployment rate and use the values in data['Year'] as the value of the x axis.
Upvotes: 1
Views: 125
Reputation: 339120
If you want to plot y
against x
, you need to inform matplotlib to do so.
plt.plot(x,y)
If instead you only call plt.plot(y)
, matplotlib would not know that you want to plot against the x
data. Instead it would take the numbers 0,1,...N-1 to plot against.
Upvotes: 4