Rachel
Rachel

Reputation: 218

Python matplotlib x-axis values

Hi I am trying to make a graph to display some data, my issue is I want the x-axis to have years value

df6=df6["percent"]
list = df6.values.tolist()

import matplotlib.pyplot as plt

plt.plot(list)
plt.show()

I get the graph 

Graph I have

But I want the graph to be like this Graph I want

Please Help!

Upvotes: 1

Views: 125

Answers (1)

Jordan Gleeson
Jordan Gleeson

Reputation: 541

I can't tell what your data looks like, but if you loop through your years data and add the value of 1880 to it all, your graph should display the x-axis similarly to the picture you have provided.

For example:

0 + 1880 = 1880
50 + 1880 = 1930
100 + 1880 = 1980

And so on..

Upvotes: 1

Related Questions