Q. Create / draw frequency polygon from the data used in above questions.
Answer :-
import matplotlib.pyplot as plt x=[78 ,72, 69 ,81 ,63 ,67 ,65 ,75 ,79 ,74 ,71, 83 ,71 ,79 ,80 ,69 ] a,bins,c=plt.hist(x,bins=7,histtype='step') l=list(bins) l.insert(0,0) l.insert(len(bins)+1,bins[len(bins)-1]) mid=[] for i in range(len(l)-1): ele=(l[i]+l[i+1])/2 mid.append(ele) x=list(a) x.insert(0,0) x.insert(len(a)+1,0) plt.plot(mid,x,'go--') plt.xlabel("Age") plt.show()
Output :-
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )