I'm trying to use the grImport
package to draw several vector graphics on one page:
grid.newpage()
grid.picture(pic1)
grid.picture(pic2)
This just draws over the older graphic. I'm looking for something similar to par(mfrow=c(2,1))
with plots, but mfrow
doesn't seem to work with grid.picture
.
I know you can set x
y
width
and height
values in grid.picture
, but is there a simpler way similar to par
?
Thanks
require(grImport)
hourglass <- new("Picture",
paths= list(new("PictureFill",
x=c(0, 1, 0, 1),
y=c(0, 0, 1, 1))),
summary= new("PictureSummary",
numPaths=1,
xscale=c(0, 1),
yscale=c(0, 1)))
g1 <- pictureGrob(hourglass, use.gc=FALSE, gp=gpar(fill="red"))
g2 <- pictureGrob(hourglass, use.gc=FALSE, gp=gpar(fill="blue"))
require(gridExtra)
grid.arrange(g1,g2, ncol=2)