Last week when trying to generate some awsome summary graphic, I came across the painful ordeal of trying to combine ggplot
elements with a number of regular R graphic elements.
First things first, I had used grid.arrange
module from gridExtra
package to juxtapose ggplot elements in a panel figure. Furthermore, I had combined regular R [read non-ggplot] figures thru the good old par
functionality.
We will be making calls to viewport
module from the gridBase
package to generate---guess what---view ports into which ggplot objects are plotted. Interestingly, ggplot
elements need not be a single simple ggplot
object, but could be an arrangement of multiple objects bundled together using arrangeGrob
module from gridExtra
.