Main.Histograms History
Hide minor edits - Show changes to markup
May 04, 2010, at 02:50 PM MST
by -
Added lines 1-34:
(:source lang=python:)
""" Make a histogram of normally distributed random numbers simplified version of http://matplotlib.sourceforge.net/examples/api/histogram_demo.html """ import numpy as np import matplotlib.pyplot as plt
- create data with normal distribution with given mean and standard deviation
mu = 100 sigma = 15 x = mu + sigma * np.random.randn(10000)
fig = plt.figure() ax = fig.add_subplot(111)
- the histogram of the data
n, bins, patches = ax.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
ax.set_xlabel('Smarts') ax.set_ylabel('Probability')
- set the x and y limits
- ax.set_xlim(40, 160)
- ax.set_ylim(0, 0.03)
- show grid-lines
ax.grid(True)
fig.show()
(:sourceend:)
