In [1]:
import time
print('Last updated:', time.strftime('%m/%d/%Y'))
In [2]:
%matplotlib inline
In [3]:
import numpy as np
# Sample from a bivariate Gaussian distribution
mean = [0,0]
cov = [[0,1],[1,0]]
x, y = np.random.multivariate_normal(mean, cov, 10000).T
In [4]:
from matplotlib import pyplot as plt
hist, xedges, yedges = np.histogram2d(x,y)
X,Y = np.meshgrid(xedges,yedges)
plt.imshow(hist)
plt.grid(True)
plt.colorbar()
plt.show()
In [6]:
plt.imshow(hist, interpolation='nearest')
plt.grid(True)
plt.colorbar()
plt.show()
In [8]:
plt.hist2d(x, y, bins=10)
plt.colorbar()
plt.grid()
plt.show()
In [10]:
plt.hist2d(x, y, bins=40)
plt.colorbar()
plt.grid()
plt.show()
In [11]:
print('x min, x max:', x.min(), x.max())
print('y min, y max:', y.min(), y.max())
In [ ]: