def plot_dist_normal ( s , mu , sigma ) : import matplotlib . pyplot as plt count , bins , ignored = plt . hist ( s , 30 , normed = True ) plt . plot ( bins , 1 / ( sigma * np . sqrt ( 2 * np . pi ) ) * np . exp ( - ( bins - mu ) ** 2 / ( 2 * sigma ** 2 ) ) , linewidth = 2 , color = 'r' ) plt . show ( )
how to overlay normal dist on histogram python
plot distribution
def plot_dist_normal(s, mu, sigma):
    """
    plot distribution
    """
    import matplotlib.pyplot as plt
    count, bins, ignored = plt.hist(s, 30, normed=True)
    plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) \
            * np.exp( - (bins - mu)**2 / (2 * sigma**2) ), \
            linewidth = 2, color = 'r')
    plt.show()