0% found this document useful (0 votes)
16 views4 pages

2

Uploaded by

samarsingh9551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

2

Uploaded by

samarsingh9551
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Matplotlib Program

Write a program to plot a line chart to depict the changing onion prices for
four weeks.
import matplotlib.pyplot as plt
week=[1,2,3,4]
prices=[40,80,100,50]
plt.plot(week,prices)
plt.xlabel("week")
plt.ylabel("onion prices(rs.)")
plt.show()

Write a program to plot the student”s performance in these 10 units tests.


import matplotlib.pyplot as plt
week=[1,2,3,4,5,6,7,8,9,10]
marks=[12,10,10,15,17,25,12,22,35,40]
plt.plot(week,marks)
plt.xlabel("week")
plt.ylabel("unit test marks")
plt.show()

Write a program to plot a bar chart from the medal won by australia.
import matplotlib.pyplot as plt
info=['gold','silver','bronze','total']
australia=[80,59,59,198]
plt.bar(info,australia)
plt.xlabel('medal type')
plt.ylabel('australia medal count')
plt.show()

Write a program to plot a bar chart from the medal won by Australia and india.
import matplotlib.pyplot as plt
info=['gold','silver','bronze','total']
australia=[80,59,59,198]
india=[26,20,20,66]
plt.bar(info,australia)
plt.bar(info,india)
plt.xlabel('medal type')
plt.ylabel('australia,india medal count')
plt.show()

You might also like