Example 3: Binomial distribution, n=100
import matplotlib.pyplot as plt
from scipy.stats import binom
import os
os.chdir('C:\\Anaconda\\mycodes\\aerospace')
os.getcwd()
fig,ax = plt.subplots(1,1)
x = range(101)
n,p = 100,0.5
rv = binom(n,p)
ax.vlines(x,0,rv.pmf(x),colors='k',linestyles='-',lw=1,label='Probability')
ax.legend(loc='best',frameon=False)
plt.savefig("example3.png", dpi=100)
plt.show()
plt.close()
Recent Comments