【Python代码】直方图的绘制

import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
mu, sigma = 100, 20#均值和标准差
a = np.random.normal(mu, sigma, size = 100)
plt.hist(a, 20, normed = 1, histtype = 'stepfilled', facecolor = 'b', alpha = 0.75)
plt.title('Histogram')
plt.show()

在这里插入图片描述

import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
mu, sigma = 100, 20#均值和标准差
a = np.random.normal(mu, sigma, size = 100)
plt.hist(a, 10, normed = 1, histtype = 'stepfilled', facecolor = 'b', alpha = 0.75)
plt.title('Histogram')
plt.show()

在这里插入图片描述

import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
mu, sigma = 100, 20#均值和标准差
a = np.random.normal(mu, sigma, size = 100)
plt.hist(a, 40, normed = 1, histtype = 'stepfilled', facecolor = 'b', alpha = 0.75)
plt.title('Histogram')
plt.show()

在这里插入图片描述
在这里插入图片描述
扫码关注“图像处理与模式识别研究所”解锁更多技能呦。

猜你喜欢

转载自blog.csdn.net/qq_41985559/article/details/109035989