def poisson_pmf(): rv=Pie(4.5)#the average incident is 4.5 x = np.arange(0, 11, 1)#return evenly spaced values within 1 interval between [1,11) y = rv.pmf(x)#probability mass function plt.bar(x, y, width=0.6, color='grey')#make bar chart plt.savefig('fig.png')
def geom_pmf(): rv=G(0.2)#probability of success is 0.2 x = np.arange(1, 11, 1)#return evenly spaced values within 1 interval between [1,11) y = rv.pmf(x)#probability mass function plt.bar(x, y, width=0.6, color='grey')#make bar chart plt.savefig('fig.png')
def draw(): #get input data menMeans = (20, 35, 30, 35, 27) menStd = (2, 3, 4, 1, 2) womenMeans = (25, 32, 34, 20, 25) womenStd = (3, 5, 2, 3, 3) ind = np.arange(5) width = 0.35 # the histogram of the data plt.bar(ind, menMeans, width, color='r') plt.bar(ind+width, womenMeans, width, color='y') #show image plt.savefig('fig.png')