position_nudge#

position_nudge(x=None, y=None, unit=None)#

Adjust position by nudging a given offset.

Parameters:
xfloat

Nudging width.

yfloat

Nudging height.

unit{‘identity’, ‘size’, ‘px’}, default=’identity’

Units for x and y nudging. Possible values:

  • ‘identity’: a unit of 1 corresponds to a difference of 1 in data space;

  • ‘size’: a unit of 1 corresponds to the diameter of a point with size=1;

  • ‘px’: the unit is measured in screen pixels.

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 = 5
 5np.random.seed(42)
 6x = np.random.uniform(size=n)
 7y = np.random.uniform(size=n)
 8t = np.random.choice(list('abcdefghijk'), size=n)
 9ggplot({'x': x, 'y': y, 't': t}, aes('x', 'y')) + \
10    geom_point(size=5, shape=21, color='black', fill='red') + \
11    geom_text(aes(label='t'), position=position_nudge(y=.05, unit='identity'))