Stay With us
3 new comments

beginner
new

Help & Settings
About
Help
Tips

How to show labels to x and y axis in plot in python

I am new to matplotlib. I have created a graph by using plot method. Now i want to show the labels on x-axis and y-axis. The x-axis contains years and y-axis contains the number of people in that specific year. So i want to show label on them as years and number of persons.

import matplotlib.pyplot as plt
year = [1950, 1960, 1965, 1970, 1980, 1990, 2010]
people = [144, 42, 35, 234, 532, 533, 313]
plt.plot(year, people)
plt.show()

(0) Replies

Please login or register to Comment or Answer