In [14]:
%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 [15]:
#Most of this code is from number 1.
#Creates a counter of 0 to 1000 and genetates random n
x = range(0,1000)
y = np.random.randn(1000)
plt.scatter(x,y, s = 10, c= 'r', alpha = 0.5)
plt.xlabel("Counter")
plt.ylabel("Random Numbers")
plt.title('Random Number 2D Generator')
ax = plt.gca()
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
Learn how to use Matplotlib's plt.hist function to make a 1d histogram.
np.random.randn.
In [18]:
#x = range(0,1000)
x = np.random.randn(10)
plt.hist(x,10)
plt.title('Random Number Generator')
plt.xlabel('Time')
plt.ylabel('Sunspots')
ax = plt.gca()
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.get_xaxis().tick_bottom()
ax.axes.get_yaxis().tick_left()
In [ ]: