geom_jitter {ggplot2}R Documentation

geom\_jitter

Description

Points, jittered to reduce overplotting

Usage

geom_jitter(mapping = NULL, data = NULL, stat = "identity", position = "jitter", 
    na.rm = FALSE, ...)

Arguments

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

Details

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.

Value

A layer

Aesthetics

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))

Advice

It is often useful for plotting categorical data.

Author(s)

Hadley Wickham, http://had.co.nz/

See Also

Examples

## 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)

[Package ggplot2 version 0.8.9 Index]