27/11/2022 6:38 pm
Topic starter
1
Plot a line chart to depict a comparison of population between India and Pakistan.
1 Answer
1
27/11/2022 6:40 pm
Topic starter
Code:
import matplotlib.pylab as plt year = [1960, 1970, 1980, 1990, 2000, 2010] pop_pakistan = [44.91, 58.09, 78.07, 107.7, 138.5, 170.6] pop_india = [449.48, 553.57, 696.783, 870.133, 1000, 1309.1] plt.plot(year, pop_india, color='orange', label="India") plt.plot(year, pop_pakistan, color='g', label="Pakistan") plt.xlabel('Countries') plt.ylabel('Population in million') plt.title('India Pakistan Population till 2010') plt.legend() plt.show()
Output:
This post was modified 2 years ago by CodeWithBishal-admin