Random Sampling

In [1]:
import numpy as np
from lets_plot import *

LetsPlot.setup_html()
In [2]:
def data(n):
    np.random.seed(123)
    cov=[[1, -.8], 
         [-.8, 1]]
    x, y = np.random.multivariate_normal(mean=[0,0], cov=cov, size=n).T
    return dict(x=x, y=y)
In [3]:
# N exceeds default point sampling threshold (50,000)
N=75000
ggplot(data(N), aes('x', 'y')) + geom_point()
Out[3]: