lets_plot.sampling_random

lets_plot.sampling_random(n, seed=None)

Return a subset of randomly selected items.

Parameters
  • n (int) – Number of items to return.

  • seed (int) – Number used to initialize a pseudo random number generator.

Returns

Random sample specification.

Return type

FeatureSpec

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))