ggplot2 Quick Reference: position

Position adjustments are used to adjust the position of each geom. The following position adjustments are available:

  • position_identity - default of most geoms
  • position_jitter - default of geom_jitter
  • position_dodge - default of geom_boxplot
  • position_stack - default of geom_bar==geom_histogram and geom_area
  • position_fill - useful for geom_bar==geom_histogram and geom_area

Setting the Position Adjustment

To set the position adjustment of a geom, use the position parameter of the layer() function:

layer(geom="point", ..., position="jitter")

Or use the position parameter of the geom_...() function:

geom_point(..., position="jitter")

Arguments to the Position Adjustment

All existing position adjustments have two arguments: "width" and "height". ggplot2 determines sensible default values for these arguments. However, in some situations you may want to override these defaults (e.g. to disable jittering along one axis). To specify the arguments when setting a position adjustment, use the position_...(...) function to create a position adjustment.

layer(geom="point", ..., position=position_jitter(width=0, height=0.1))


geom_point(..., position=position_jitter(width=0, height=0.1))