#!/usr/bin/env python
#~ import numpy as np
#~ import matplotlib.mlab as mlab
#~ import matplotlib.pyplot as plt

#~ mu, sigma = 100, 15
#~ x = mu + sigma*np.random.randn(10)

#~ print x

# the histogram of the data
#~ n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75)


# add a 'best fit' line
#~ y = mlab.normpdf( bins, mu, sigma)
#~ l = plt.plot(bins, y, 'r--', linewidth=1)

#~ plt.xlabel('Smarts')
#~ plt.ylabel('Probability')
#~ plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
#~ plt.axis([40, 160, 0, 0.03])
#~ plt.grid(True)

#~ plt.show()



import random
import numpy
from matplotlib import pyplot

x = [random.gauss(3,1) for _ in range(400)]
y = [random.gauss(4,2) for _ in range(400)]

bins = numpy.linspace(-10, 10, 101)

print bins

pyplot.hist(x, bins, alpha=0.5, label='x')
pyplot.hist(y, bins, alpha=0.5, label='y')
pyplot.legend(loc='upper right')
pyplot.show()