In [22]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
Learn how to use Matplotlib's plt.scatter function to make a 2d scatter plot.
np.random.randn.
In [23]:
N = 50
x = np.random.rand(N)#random x vals
y = np.random.rand(N)#random y vals
colors = np.random.rand(N)#makes random colors
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses
plt.ylabel("y")
plt.xlabel("x")
plt.scatter(x, y, s=area, c=colors, alpha=0.5)# makes scatter
Out[23]:
Learn how to use Matplotlib's plt.hist function to make a 1d histogram.
np.random.randn.
In [24]:
mu, sigma = 200, 25
x = mu + sigma*np.random.randn(1000)
n, bins, patches = P.hist(x, 50, normed=1, histtype='bar')
P.setp(patches, 'facecolor', 'r', 'alpha', 0.75)
y = P.normpdf( bins, mu, sigma)
l = P.plot(bins, y, 'k--', linewidth=1.5)
In [ ]: