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 [2]:
fig, ax = plt.subplots(figsize=(9,6))
ax.scatter(np.random.randn(20), np.random.randn(20))
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')
plt.xlabel('Random y');
plt.ylabel('Random x');
plt.title('Plot of a Random (x,y)');
Learn how to use Matplotlib's plt.hist
function to make a 1d histogram.
np.random.randn
.
In [8]:
fig, ax = plt.subplots(figsize=(9,6));
ax.hist(np.random.randn(9001),bins=20,align='mid',histtype='stepfilled');
plt.xlabel('Random Number');
plt.ylabel('Occurences');
plt.title('Histogram for a set of random numbers');
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')
I worked with Hunter Thomas for this exercise