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

Appearance settings

Commit b75f7eb

Browse filesBrowse files
committed
Added an example for histograms with histtype='step'
svn path=/trunk/matplotlib/; revision=5146
1 parent 7b773fe commit b75f7eb
Copy full SHA for b75f7eb

File tree

Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-0
lines changed

‎examples/histogram_demo_step.py

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
from pylab import *
3+
4+
mu, sigma = 100, 15
5+
x = mu + sigma*randn(10000)
6+
7+
# the histogram of the data
8+
n, bins, patches = hist(x, 50, normed=1, histtype='step')
9+
setp(patches, 'facecolor', 'g', 'alpha', 0.75)
10+
11+
# add a 'best fit' line
12+
y = normpdf( bins, mu, sigma)
13+
l = plot(bins, y, 'k--', linewidth=1)
14+
15+
16+
# overlay the first histogram with a second one
17+
# were the data has a smaller standard deviation
18+
mu, sigma = 100, 5
19+
x = mu + sigma*randn(10000)
20+
21+
n, bins, patches = hist(x, 50, normed=1, histtype='step')
22+
setp(patches, 'facecolor', 'r', 'alpha', 0.25)
23+
24+
y = normpdf( bins, mu, sigma)
25+
l = plot(bins, y, 'k--', linewidth=1)
26+
27+
axis([40, 160, 0, 0.09])
28+
grid(True)
29+
30+
#savefig('histogram_demo',dpi=72)
31+
show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.