lets_plot.position_jitter

lets_plot.position_jitter(width=None, height=None)

Adjust position by assigning random noise to points. Better for discrete values.

Parameters
widthfloat

Jittering width.

heightfloat

Jittering height.

Returns
FeatureSpec

Geom object position specification.

Notes

Adjust position by dodging overlaps to the side.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4n = 100
 5np.random.seed(42)
 6x = np.random.randint(4, size=n)
 7y = np.random.randint(3, size=n)
 8c = np.char.add(x.astype(str), y.astype(str))
 9ggplot({'x': x, 'y': y, 'c': c}, aes('x', 'y')) + \
10    geom_point(aes(fill='c'), show_legend=False, \
11               size=8, alpha=.5, shape=21, color='black', \
12               position=position_jitter(width=.2, height=.2))