position_jitterdodge#

position_jitterdodge(dodge_width=None, jitter_width=None, jitter_height=None, seed=None)#

This is primarily used for aligning points generated through geom_point() with dodged boxplots (e.g., a geom_boxplot() with a fill aesthetic supplied).

Parameters:
dodge_widthfloat

Bin width. The value of dodge_width is relative and typically ranges between 0 and 1. Values that are greater than 1 lead to overlapping of the boxes.

jitter_widthfloat

Jittering width. The value of jitter_width is relative and typically ranges between 0 and 0.5. Values that are greater than 0.5 lead to overlapping of the points.

jitter_heightfloat

Jittering height. The value of jitter_height is relative and typically ranges between 0 and 0.5. Values that are greater than 0.5 lead to overlapping of the points.

seedint

A random seed to make the jitter reproducible. If None (the default value), the seed is initialised with a random value.

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 = 50
 5np.random.seed(42)
 6x = np.random.uniform(size=n)
 7c = np.random.choice(['a', 'b', 'c'], size=n)
 8ggplot({'x': x, 'c': c}) + \
 9    geom_crossbar(aes(x='c', y='x', color='c'), \
10                  stat='boxplot') + \
11    geom_point(aes(x='c', y='x', color='c'), \
12               size=4, shape=21, fill='white',
13               position=position_jitterdodge(seed=42))