2
2
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 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()