position_jitter
From ggplot2 v0.9.3.1
by Hadley Wickham
Jitter points to avoid overplotting.
Jitter points to avoid overplotting.
Usage
position_jitter(width = NULL, height = NULL)
Arguments
- width
- degree of jitter in x direction. Defaults to 40% of the resolution of the data.
- height
- degree of jitter in y direction. Defaults to 40% of the resolution of the data
See Also
Other position adjustments: position_dodge
,
position_fill
,
position_identity
,
position_stack
Examples
qplot(am, vs, data = mtcars)
# Default amount of jittering will generally be too much for
# small datasets:
qplot(am, vs, data = mtcars, position = "jitter")
# Control the amount as follows
qplot(am, vs, data = mtcars, position = position_jitter(w = 0.1, h = 0.1))
# With ggplot
ggplot(mtcars, aes(x = am, y = vs)) + geom_point(position = "jitter")
ggplot(mtcars, aes(x = am, y = vs)) + geom_point(position = position_jitter(w = 0.1, h = 0.1))
# The default works better for large datasets, where it will
# take up as much space as a boxplot or a bar
qplot(class, hwy, data = mpg, geom = c("boxplot", "jitter"))
Community examples
Looks like there are no examples yet.