position_stack#

position_stack(vjust=None, mode=None)#

Adjust position by stacking overlapping objects on top of each other. Preferred for density-like geometries.

Parameters:
vjustfloat

Vertical adjustment for geoms that have a position (like points or lines), not a dimension (like bars or areas). Set to 0 to align with the bottom, 0.5 for the middle, and 1 for the top.

mode{‘groups’, ‘all’}, default=’groups’

If ‘groups’, objects inside one group are positioned as in position=’identity’, but each group is shifted to sum of heights of previous groups (where height of a group is a maximum of it’s y values). If ‘all’, each object will be shifted.

Returns:
FeatureSpec

Geom object position specification.

Notes

Adjust position by stacking overlapping objects on top of each other.

Examples

1from lets_plot import *
2LetsPlot.setup_html()
3data = {
4    'x': [1, 1, 1, 2, 2, 2],
5    'y': [1, 2, 3, 1, 2, 3],
6    'g': ["a", "b", "b", "a", "a", "b"],
7}
8ggplot(data, aes('x', 'y', color='g')) + \
9    geom_point(position=position_stack(), size=10)