In [30]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from __future__ import print_function
from IPython.html.widgets import interact, interactive, fixed
from IPython.html import widgets
Learn how to use Matplotlib's plt.scatter
function to make a 2d scatter plot.
np.random.randn
.
In [21]:
randx = np.random.randn(500)
randy = np.random.randn(500)
plt.scatter(randx, randy, color = "g", marker = "x")
plt.xlabel("Random X")
plt.ylabel("Random Y")
plt.title("Random Data!!!!!")
plt.box(False)
plt.grid(True)
Learn how to use Matplotlib's plt.hist
function to make a 1d histogram.
np.random.randn
.
In [41]:
data = np.random.randn(500000)
def plothist(bins, numdata):
plt.hist(np.random.randn(numdata), bins=bins, color = "k", ec = "w")
interact(plothist, bins=widgets.IntSlider(min=1,max=100,step=1,value=10), numdata=\
widgets.IntSlider(min=10,max=10000,step=10,value=10));
plt.xlabel("Random Variable X")
plt.ylabel("Counts")
plt.title("Distribution of a random variable in abjustable bins.")
In [ ]: