Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7b2217

Browse files
committed
Simplify example.
Remove plot of exact PDF since this is already demoed in another example.
1 parent6d1b8a2 commitf7b2217

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

‎examples/pylab_examples/histogram_demo_histtypes.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,20 @@
77
"""
88
importnumpyasnp
99
importmatplotlib.pyplotasplt
10-
frommatplotlibimportmlab
1110

1211

1312
mu=200
1413
sigma=25
15-
n_bins=50
1614
x=mu+sigma*np.random.randn(10000)
1715

1816
fig, (ax0,ax1)=plt.subplots(ncols=2,figsize=(8,4))
1917

20-
n,bins,patches=ax0.hist(x,n_bins,normed=1,histtype='stepfilled',
21-
facecolor='g',alpha=0.75)
22-
# Add a line showing the expected distribution.
23-
y=mlab.normpdf(bins,mu,sigma)
24-
ax0.plot(bins,y,'k--',linewidth=1.5)
18+
ax0.hist(x,20,normed=1,histtype='stepfilled',facecolor='g',alpha=0.75)
2519
ax0.set_title('stepfilled')
2620

2721
# Create a histogram by providing the bin edges (unequally spaced).
2822
bins= [100,150,180,195,205,220,250,300]
29-
n,bins,patches=ax1.hist(x,bins,normed=1,histtype='bar',rwidth=0.8)
23+
ax1.hist(x,bins,normed=1,histtype='bar',rwidth=0.8)
3024
ax1.set_title('unequal bins')
3125

3226
plt.tight_layout()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp