ggplot2 and lattice on the same plot

ggplot2オブジェクトとlatticeオブジェクトを同じ画面に描くにはgridExtraを使うと良い。

library(ggplot2)
library(lattice)
library(gridExtra)
grid.arrange(qplot(1:10), xyplot(1:10 ~ 1:10), ncol = 2)

plot of chunk unnamed-chunk-1

grid.arrange(qplot(1:10), xyplot(1:10 ~ 1:10), nrow = 2)

plot of chunk unnamed-chunk-2