In [2]:
%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 [8]:
data = np.random.randn(2, 100)
plt.scatter(data[0], data[1])
plt.xlabel("Random Number 1", fontsize=12, color="#666666")
plt.ylabel("Random Number 2", fontsize=12, color="#666666")
ax = plt.gca()
ax.spines['right'].set_color("None")
ax.spines['top'].set_color("None")
ax.spines['bottom'].set_color("#666666")
ax.spines['left'].set_color("#666666")
ax.tick_params(axis='x', colors='#666666')
ax.tick_params(axis='y', colors='#666666')
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
plt.title("2D Random Number Scatter Plot", color="#383838")
Out[8]:
Learn how to use Matplotlib's plt.hist function to make a 1d histogram.
np.random.randn.
In [9]:
data = np.random.randn(50)
plt.hist(data, 20, facecolor='green', )
plt.xlabel("Random Number", fontsize=12, color="#666666")
plt.ylabel("Probability", fontsize=12, color="#666666")
ax = plt.gca()
ax.spines['right'].set_color("None")
ax.spines['top'].set_color("None")
ax.spines['bottom'].set_color("#666666")
ax.spines['left'].set_color("#666666")
ax.tick_params(axis='x', colors='#666666')
ax.tick_params(axis='y', colors='#666666')
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
plt.title("Random Number Histogram", color="#383838")
Out[9]:
In [ ]:
# used "Joe Kington"'s (from stackoverflow) method for setting axis tick and label colors
# used "timday"'s (from stackoverflow) method for hiding the top and right axis and ticks