2021-02-09
閱讀量:
3383
AttributeError:' Rectangle ' object has no property 'normed ' .
這個是因為包的版本更新,移除了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$') # 調(diào)整間距以防止ylabel被覆蓋 plt.tight_layout() plt.show()






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
0條評論