A geom that draws a polygon.
Default statistic: stat_identity
Default position adjustment: position_identity
The following example shows how a data frame can define multiple polygons (in this example, two polygons). We add two extra layers to show the points (colored by polygon) and to label each point (with the observation=point number).
d=data.frame(x=c(1,2,2, 3,4,4), y=c(1,1,2, 2,2,3), t=c('a', 'a', 'a', 'b', 'b', 'b'), r=c(1,2,3, 4,5,6)) ggplot() + geom_polygon(data=d, mapping=aes(x=x, y=y, group=t)) + geom_point(data=d, aes(x=x, y=y, color=t)) + geom_text(data=d, aes(x=x, y=y, label=r), hjust=0, vjust=1, size=4) + opts(title="geom_polygon", plot.title=theme_text(size=40, vjust=1.5))