lets_plot.sampling_random#

lets_plot.sampling_random(n, seed=None)#

Return a subset of randomly selected items.

Parameters:
nint

Number of items to return.

seedint

Number used to initialize a pseudo random number generator.

Returns:
FeatureSpec

Random sample specification.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4np.random.seed(27)
 5mean = np.zeros(2)
 6cov = [[.9, -.6],
 7       [-.6, .9]]
 8x, y = np.random.multivariate_normal(mean, cov, 10000).T
 9ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + \
10    geom_point(sampling=sampling_random(1000, 35))