See 021-ggplot2-geoms.Rnw for the full code. The basic idea is to construct the code chunks before knit them. The code is short, so probably I do not need to explain it too much.
In theory you should be able to get something like this (more than 200 pages of ggplot2 examples):