lets_plot.position_dodge#

lets_plot.position_dodge(width=None)#

Adjust position by dodging overlaps to the side.

Parameters:
widthfloat

Dodging width, when different to the width of the individual elements. This is useful when you want to align narrow geoms with wider geoms. The value of width is relative and typically ranges between 0 and 1. Values that are greater than 1 lead to overlapping of the objects.

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(5, size=n)
 7c = np.random.choice(['a', 'b', 'c'], size=n)
 8ggplot({'x': x, 'c': c}, aes(x='x')) + \
 9    geom_bar(aes(fill='c'), width=.4, \
10             position=position_dodge(width=.6))