|
From: <mme...@us...> - 2008-05-16 13:41:28
|
Revision: 5146
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5146&view=rev
Author: mmetz_bn
Date: 2008-05-16 06:41:25 -0700 (Fri, 16 May 2008)
Log Message:
-----------
Added an example for histograms with histtype='step'
Added Paths:
-----------
trunk/matplotlib/examples/histogram_demo_step.py
Added: trunk/matplotlib/examples/histogram_demo_step.py
===================================================================
--- trunk/matplotlib/examples/histogram_demo_step.py (rev 0)
+++ trunk/matplotlib/examples/histogram_demo_step.py 2008-05-16 13:41:25 UTC (rev 5146)
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+from pylab import *
+
+mu, sigma = 100, 15
+x = mu + sigma*randn(10000)
+
+# the histogram of the data
+n, bins, patches = hist(x, 50, normed=1, histtype='step')
+setp(patches, 'facecolor', 'g', 'alpha', 0.75)
+
+# add a 'best fit' line
+y = normpdf( bins, mu, sigma)
+l = plot(bins, y, 'k--', linewidth=1)
+
+
+# overlay the first histogram with a second one
+# were the data has a smaller standard deviation
+mu, sigma = 100, 5
+x = mu + sigma*randn(10000)
+
+n, bins, patches = hist(x, 50, normed=1, histtype='step')
+setp(patches, 'facecolor', 'r', 'alpha', 0.25)
+
+y = normpdf( bins, mu, sigma)
+l = plot(bins, y, 'k--', linewidth=1)
+
+axis([40, 160, 0, 0.09])
+grid(True)
+
+#savefig('histogram_demo',dpi=72)
+show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|