sampling_group_random#

sampling_group_random(n, seed=None)#

Return a subset of randomly selected groups.

Parameters:
nint

Number of groups to return.

seedint

Number used to initialize a pseudo random number generator.

Returns:
FeatureSpec

Group sample specification.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4waves_count = 100
 5peak_amplitude = np.linspace(1, 2, waves_count)
 6wave_x = np.linspace(-np.pi, np.pi, 30)
 7x = np.tile(wave_x, waves_count)
 8y = np.array([a * np.sin(wave_x) for a in peak_amplitude]).flatten()
 9a = np.repeat(peak_amplitude, wave_x.size)
10ggplot({'x': x, 'y': y, 'a': a}, aes('x', 'y')) + \
11    geom_line(aes(group='a', color='a'), sampling=sampling_group_random(10, 35))