热线电话:13121318867

登录
2021-02-09 阅读量: 3276
AttributeError:' Rectangle ' object has no property 'normed ' .

image.png

image.png

这个是因为包的版本更新,移除了normed方法,可以用下面的代码

import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from scipy.stats import norm
mu = 100    # 均值
sigma = 15  # 标准差
x = mu + sigma * np.random.randn(1000)
n, bins, patches = plt.hist(x, 50, density=True)
# 添加拟合曲线
y = norm.pdf(bins, mu, sigma)
plt.plot(bins, y, '--')
plt.xlabel('Smarts')
plt.ylabel('Probability density')
plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')
# 调整间距以防止ylabel被覆盖
plt.tight_layout()
plt.show()


285.0201
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子