I’m in the middle of creating a poster and wanted to compresss the content by transforming some of the charts into subplots of other charts.
I made a little survey and found that there is a TeachingDemos library in CRAN that fits my needs. Well, the parameterization of the functions is a bit tricky but after a few tries you get used to it.
However, there is a minor flaw in the code of version 2.7: when I wanted to use multiple plots on one layout (e.g., next to each other to use a common legend), it always drew the charts into the first plotting area. A bit of Googling helped, my solution is based on this thread on the R-help list since October, 2010. If you manage to install version 2.8, the problem is solved automatically. On the other side, if you want a quick solution, add the following code segment to your script (so it is shadowing the original function definition).
Only change the first 3 lines of the code, leave the other untouched (you can verify it by diffing this code and entering
subplot into the R console).
There is a second workaround suggested in the aforementioned thread, namely managing
par('mfg') by hand before and after executing the
subplot() function, but it didn’t work for me. The third option (wait a few days until the CRAN packages are updated to 2.8) seems to take a bit longer. 🙂 Anyway, it is working so I’m happy.