geom_jittergeom_jitter(mapping=NULL, data=NULL, stat="identity", position="jitter", na.rm=FALSE, ...)
Points, jittered to reduce overplotting
The jitter geom is a convenient default for geom_point with position = 'jitter'. See position_jitter for more details on adjusting the amount of jittering.
This page describes geom_jitter, see layer and qplot for how to create a complete plot from individual components.
It is often useful for plotting categorical data.
What do you think of the documentation? Please let me know by filling out this short online survey.
The following aesthetics can be used with geom_jitter. Aesthetics are mapped to variables in the data with the aes function: geom_jitter(aes(x = var)). Note that you do not need quotes around the variable name.
Scales control how the variable is mapped to the aesthetic and are listed after each aesthetic.
| Aesthetic | Default | Related scales |
|---|---|---|
| x | required | continuous, date, datetime, discrete |
| y | required | continuous, date, datetime, discrete |
| shape | 16 | identity, manual, shape |
| colour | black | brewer, gradient, gradient2, gradientn, grey, hue, identity, manual |
| size | 2 | identity, manual, size |
| fill | NA | brewer, gradient, gradient2, gradientn, grey, hue, identity, manual |
| alpha | 1 |
Layers are divided into groups by the group aesthetic. By default this is set to the interaction of all categorical variables present in the plot.
Parameters control the appearance of the geom. In addition to the parameters listed below (if any), any aesthetic can be used as a parameter, in which case it will override any aesthetic mapping.
na.rm: NULLThis function returns a layer object.
> p <- ggplot(movies, aes(x=mpaa, y=rating)) > p + geom_point()> p + geom_point(position = "jitter")
> > # Add aesthetic mappings > p + geom_jitter(aes(colour=rating))
> > # Vary parameters > p + geom_jitter(position=position_jitter(width=5))
> p + geom_jitter(position=position_jitter(height=5))
> > # Use qplot instead > qplot(mpaa, rating, data=movies, geom="jitter")
> qplot(mpaa, rating, data=movies, geom=c("boxplot","jitter"))
> qplot(mpaa, rating, data=movies, geom=c("jitter", "boxplot"))
![]()
What do you think of the documentation? Please let me know by filling out this short online survey.