Gundala Viswanath <gundalav <at> gmail.com> writes:
> I have a simple plot using "gridBase" like this.
>
> The problem occurs whenever I execute this code
> there is always a blank page created before the actual plot.
>
> How can we disable that blank page?
>
> __ BEGIN__
> library(grid)
> library(gridBase)
> opar <- par(no.readonly=TRUE)
>
> par(opar)
> grid.newpage()
> pushViewport(viewport(width=0.5, height=0.5))
> grid.rect(gp=gpar(col="grey", lty="dashed"))
> par(omi=gridOMI())
> par(mfrow=c(2, 2), mfg=c(1, 1), mar=c(3, 3, 1, 0))
> for (i in 1:4) {
> plot(1:10)
> }
> __ END__
>
The question is: why do you mix standard graphics with grid? There might
be reasons to do so, but I don't see why this is the case here. Simply
omit all grid calls:
# NO additional library required
par(mfrow=c(2, 2), mfg=c(1, 1), mar=c(3, 3, 1, 0))
for (i in 1:4) {
plot(1:10)
}
Dieter