A geom that draws a point defined by an x and y coordinate.
Default statistic: stat_identity
Default position adjustment: position_identity
This example shows a scatterplot. It represents a rather common configuration (just a geom_point
layer with use of some extra aesthetic parameters, such as size, shape, and color). The plot uses two aesthetic properties to represent the same aspect of the data (the gender
column is mapped into a shape and into a color), which is possible but might be a bit overdone. The plot maps the continuous speed
column onto the aesthetic size
property. To ensure that even observations with a "low" speed are still mapped to rather large points, the plot explicitly uses scale_size_continuous
to define the range of point sizes to use.
d=data.frame(beauty=c(1,2,6,4,4,6,7,8), intelligence=c(8,4,7,5,4,9,2,3), speed=c(7,6,9,5,7,6,7,8), gender=c('m','m','f','m','f','f','f','m')) ggplot() + scale_size_continuous(to=c(4,12)) + geom_point(data=d, mapping=aes(x=intelligence, y=beauty, shape=gender, color=gender, size=speed)) + opts(title="geom_point", plot.title=theme_text(size=40, vjust=1.5))