In [1]:
%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 [61]:
np.random.seed(33)
plt.figure(figsize=(6,6))
x = np.random.randn(50)
y = np.random.randn(50) + 2 * x
plt.scatter(x,y, c='r', marker='o', alpha=.3, s = 100)
plt.xlabel("Random x value")
plt.ylabel("Random y value")
plt.title("Random Scatter Plot")
Out[61]:
Learn how to use Matplotlib's plt.hist function to make a 1d histogram.
np.random.randn.
In [59]:
np.random.seed(43)
plt.figure(figsize=(8,4))
x = np.log(np.random.rand(500))
plt.hist(x, alpha = .3, color = 'yellow', normed=True)
plt.xlabel("Log of Random Uniform")
plt.ylabel("Density")
plt.title("Example histogram")
Out[59]:
In [ ]: