histogram_demo.py

来自「非原创。很好的python例子」· Python 代码 · 共 24 行

PY
24
字号
#!/usr/bin/env pythonfrom pylab import *mu, sigma = 100, 15x = mu + sigma*randn(10000)# the histogram of the datan, bins, patches = hist(x, 50, normed=1)setp(patches, 'facecolor', 'g', 'alpha', 0.75)# add a 'best fit' liney = normpdf( bins, mu, sigma)l = plot(bins, y, 'r--')setp(l, 'linewidth', 1)xlabel('Smarts')ylabel('Probability')title(r'$\rm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')axis([40, 160, 0, 0.03])grid(True)#savefig('histogram_demo',dpi=72)show()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?