ggpoint {ggplot} | R Documentation |
Add points to a plot
ggpoint(plot = .PLOT, aesthetics=list(), ..., data=NULL)
plot |
the plot object to modify |
aesthetics |
named list of aesthetic mappings, see details for more information |
... |
other options, see details for more information |
data |
data source, if not specified the plot default will be used |
Aesthetic mappings that this grob function understands:
x
:x position (required)
y
:y position (required)
size
:size of the point, in mm (see scsize)
shape
:shape of the glyph used to draw the point (see scshape)
colour
:point colour (see sccolour)
These can be specified in the plot defaults (see ggplot
) or
in the aesthetics
argument. If you want to modify the position
of the points or any axis options, you will need to add a position scale to
the plot. These functions start with ps
, eg.
pscontinuous
or pscategorical
Other options:
unique
:if TRUE, draw at most one point at each unique location
Hadley Wickham <h.wickham@gmail.com>
p <- ggplot(mtcars, aesthetics=list(x=wt, y=mpg)) ggpoint(p) ggpoint(p, list(colour=cyl)) ggpoint(p, list(blahbalh=cyl)) #unknown aesthetics are ignored ggpoint(p, list(shape=cyl)) ggpoint(p, list(shape=cyl, colour=cyl)) ggpoint(p, list(size=mpg)) ggpoint(p, list(size=mpg/wt)) ggpoint(p, list(x=cyl, colour=cyl)) p <- ggplot(mtcars) ggpoint(p, aesthetics=list(x=wt, y=mpg))