| geom_jitter {ggplot2} | R Documentation |
Points, jittered to reduce overplotting
geom_jitter(mapping=NULL, data=NULL, stat="identity", position="jitter", ...)
mapping |
mapping between variables and aesthetics generated by aes |
data |
dataset used in this layer, if not specified uses plot dataset |
stat |
statistic used by this layer |
position |
position adjustment used by this layer |
... |
ignored |
The jitter geom is a convenient default for geom_point + 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.
A layer
The following aesthetics can be used with geom_jitter. Aesthetics are mapped to variables in the data with the aes function: geom\_jitter(\code{aes}(x = var))
x: x position (required)
y: y position (required)
shape: shape of point
colour: border colour
size: size
fill: internal colour
It is often useful for plotting categorical data.
Hadley Wickham, http://had.co.nz/
geom_point: Regular, unjittered points
geom_boxplot: Another way of looking at the conditional distribution of a variable
position_jitter: For examples, using jittering with other geoms
## Not run:
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(xjitter=5))
p + geom_jitter(position=position_jitter(yjitter=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"))
## End(Not run)