I’m trying to plot multiple lattice plots in a grid.
To do so I’m using the following code:
plot <- xyplot(1:10~1:10)
page.layout <- grid.layout(nrow = 2, ncol = 1,
widths = unit(c(1), "null"),
heights = unit(c(1), "null"),
default.units = "null",
respect = FALSE,
just = "centre")
pushViewport(viewport(layout = page.layout))
pushViewport(viewport(layout.pos.row = 1))
par(mar = c(5, 4, 4, 2))
print(plot, newpage = FALSE)
popViewport()
pushViewport(viewport(layout.pos.row = 2))
par(mar = c(5, 4, 4, 2))
print(plot, newpage = FALSE)
popViewport()
I’d like now to reduce the space between the two figure, I read in the vignette for gridBase, that simple graphic controls, such has par(mar=c()) should be working, but it is not the case here.
Maybe I’m missing something obvious, but I can’t figure out, why I can’t control the margin parameters.
Any suggestions?
latticeprovides some options to control the plot margins,