| geom_jitter {ggplot2} | R Documentation |
Points, jittered to reduce overplotting
geom_jitter(mapping = NULL, data = NULL, stat = "identity", position = "jitter",
na.rm = FALSE, ...)
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 |
na.rm |
NULL |
... |
ignored |
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.
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(aes(x = var))
x: x position (required)
y: y position (required)
shape: shape of point
colour: border colour
size: size
fill: internal colour
alpha: transparency
It is often useful for plotting categorical data.
Hadley Wickham, http://had.co.nz/
## 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(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"))
## End(Not run)