Akhilesh verma - Program9
Akhilesh verma - Program9
Matplotlib is a plotting library for the Python programming language and its
numerical mathematics extension of NumPy. In Matplotlib pyplot is a state-
based interface to matplotlib.
plt.title('simple graph')
plt.plot([1,2,3],[4,5,1])
plt.show()
plt.bar([0.25,1.25,2.25,3.25,4.25],[50,40,70,80,20],width=.5)
plt.bar([.75,1.75,2.75,3.75,4.75],[80,20,20,50,60],color='r',width=.5)
plt.title('bar graph')
plt.show()
population_age =
[22,55,62,45,21,22,34,42,42,4,2,102,95,85,55,110,120,70,65,55,111,115,80,75,65,54,44,43,42,48]
bins = [0,10,20,30,40,50,60,70,80,90,100]
plt.title('Histogram')
plt.show()
x = [1,1.5,2,2.5,3,3.5,3.6]
y = [7.5,8,8.5,9,9.5,10,10.5]
x1=[8,8.5,9,9.5,10,10.5,11]
y1=[3,3.5,3.7,4,4.5,5,5.2]
plt.scatter(x,y,color='r')
plt.scatter(x1,y1,color='b')
plt.title('Scatter Plot')
plt.legend()
plt.show()
days = [1,2,3,4,5]
Program no.9
sleeping =[7,8,6,11,7]
eating = [2,3,4,3,2]
working =[7,8,7,2,2]
playing = [8,5,7,8,13]
slices = [7,2,2,13]
cols = ['c','m','r','b']
plt.pie(slices,
colors=cols,
startangle=90,
shadow= True,
explode=(0,0.1,0,0),
autopct='%1.1f%%')
plt.title('Pie Plot')
plt.show()