Menu

[r472]: / trunk / htdocs / screenshots / histogram_demo.py  Maximize  Restore  History

Download this file

25 lines (18 with data), 527 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from matplotlib import rcParams
rcParams['text.fontname'] = 'cmr10'
from matplotlib.matlab import *
mu, sigma = 100, 15
x = mu + sigma*randn(10000)
# the histogram of the data
n, bins, patches = hist(x, 100, normed=1)
# add a 'best fit' line
y = normpdf( bins, mu, sigma)
l = plot(bins, y, 'r--')
set(l, 'linewidth', 2)
set(gca(), 'xlim', [40, 160])
xlabel('Smarts')
ylabel('P')
title(r'$\rm{IQ:}\/ \mu=100,\/ \sigma=15$')
savefig('histogram_demo_small.png', dpi=60)
savefig('histogram_demo_large.png', dpi=120)
show()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.