12.5 geom_polygon
See also the hexbin templates in pubtheme
.
Code
## Data frame with coordinates of the corners of polygons
## along with which polygon each x,y cooresponds to,
## and a probability to be used to fill the polygon
df = data.frame( x=c(1,2,2,1, 3,4,4),
y=c(1,1,2,2, 1,1,2),
group=c(1,1,1,1, 2,2,2),
p=c(.1,.1,.1,.1, .2, .2, .2))
ggplot(df,
aes(x, y,
group=group, ## says which shape each x,y belong to
fill=p))+ ## says to color by p
geom_polygon()