阅读背景:

在python中画正态分布/正弦曲线图像/心形线

来源:互联网 

1 在python中画正态分布图像

import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt

def demo2():
    mu, sigma , num_bins = 0, 1, 50
    x = mu + sigma * np.random.randn(1000000)
    n, bins, patches = plt.hist(x, num_bins, normed=True, facecolor = 'blue', alpha = 0.5)
    y = mlab.normpdf(bins, mu, sigma)
    plt.plot(bins, y, 'r--')
    plt.xlabel('Expectation')
    plt.ylabel('Probability')
    plt.title('histogram of normal distribution: $\mu = 0$, $\sigma=1$')

    plt.subplots_adjust(left = 0.15)
    plt.show()

print('curve')
demo2()import numpy as np
impo



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: