3.1par(oma=rep(3,4),bg=gray80)plot(c(0,1),c(0,1),type=n,ann=FALSE,axes=FALSE)box(outer,col=gray)#setclippingtofigureregionpar(xpd=TRUE)#deliberatelydrawastupidlylargerectanglerect(-1,-1,2,2,col=gray90)box(figure)#setclippingbacktoplotregionpar(xpd=FALSE)#deliberatelydrawastupidlylargerectanglerect(-1,-1,2,2,col=gray80)box(plot,lty=dashed)text(.5,.5,PlotRegion)mtext(FigureRegion,side=3,line=2)for(iin1:4)mtext(paste(Outermargin,i),side=i,line=1,outer=TRUE)3.2par(oma=rep(3,4),mfrow=c(3,2),bg=gray80)for(iin1:6){if(i==3){omar-par(mar=c(2,2,2,1))plot(c(0,1),c(0,1),type=n,ann=FALSE,axes=FALSE)par(xpd=TRUE)rect(-1,-1,2,2,col=gray90)box(figure)par(xpd=FALSE)rect(-1,-1,2,2,col=gray80)box(plot,lty=dashed)text(.5,.5,CurrentPlotRegion,cex=1.5)mtext(CurrentFigureRegion,side=3)par(omar)}else{omar-par(mar=rep(0,4))plot(c(0,1),c(0,1),type=n,ann=FALSE,axes=FALSE)par(xpd=TRUE)rect(-1,-1,2,2,col=gray90)box(figure)text(.5,.5,paste(Figure,i),cex=1.5)par(omar)}}box(outer,col=gray)for(iin1:4)mtext(paste(Outermargin,i),side=i,line=1,outer=TRUE)3.3par(mar=c(3,6,2,2),xaxs=i,yaxs=i,xpd=FALSE,las=1)plot(c(0,1),c(0,1),type=n,ann=FALSE,axes=FALSE)box(figure)rect(0,0,1,1,col=lightgray,border=gray)axis(1,at=c(0,1),c(,))mtext(Minx-value,side=1,adj=0,line=1)mtext(Maxx-value,side=1,adj=1,line=1)axis(2,at=c(0,1),c(,))mtext(Miny-value,side=2,at=0,adj=1,line=1)mtext(Maxy-value,side=2,at=1,adj=1,line=1)lines(c(.6,.6,0),c(0,.6,.6),lty=dashed)text(.6,.6,expression(paste(Thelocation,group((,list(x[i],y[i]),)))),pos=3)points(.6,.6,pch=16)axis(1,at=.6,)mtext(expression(x[i]),side=1,at=.6,line=.7)axis(2,at=.6,)mtext(expression(y[i]),side=2,at=.6,line=.7)3.4pushViewport(viewport(layout=grid.layout(3,1,heights=unit(rep(1,3),c(null,cm,null)))))pushViewport(viewport(layout.pos.row=1))grid.rect()pushViewport(plotViewport(c(5,5,3,2),xscale=c(0,11)))grid.rect(gp=gpar(col=gray))grid.text(CurrentPlot,gp=gpar(col=gray))grid.rect(0,unit(-5,lines),1,unit(5,lines),just=c(left,bottom),gp=gpar(col=gray,fill=lightgray))grid.text(Figure\nMargin\n1,y=unit(-2.5,lines))grid.lines(c(0,1),c(0,0))grid.segments(c(0,1),c(0,0),c(0,1),unit(c(.5,.5),lines))grid.text(c(xmin,xmax),c(0,1),unit(c(1,1),lines))grid.lines(c(0,0),unit(c(-1,-4),lines))grid.segments(c(0,0),unit(c(-1,-4),lines),unit(c(-.5,-.5),lines),unit(c(-1,-4),lines))grid.text(c(0lines,3lines),unit(c(-1,-1),lines),unit(c(-1,-4),lines),just=c(right,bottom))popViewport(2)pushViewport(viewport(layout.pos.row=3))grid.rect()pushViewport(plotViewport(c(5,5,3,2),yscale=c(0,11)))grid.rect(gp=gpar(col=gray))grid.text(CurrentPlot,gp=gpar(col=gray))grid.rect(unit(-5,lines),0,unit(5,lines),1,just=c(left,bottom),gp=gpar(col=gray,fill=lightgray))grid.text(Figure\nMargin\n2,x=unit(-2.5,lines))grid.lines(c(0,0),c(0,1))grid.segments(c(0,0),c(0,1),unit(c(.5,.5),lines),c(0,1))grid.text(c(ymin,ymax),unit(c(1,1),lines),c(0,1),just=left)grid.lines(unit(c(0,-3),lines),c(0,0))grid.segments(unit(c(0,-3),lines),c(0,0),unit(c(0,-3),lines),unit(c(-.5,-.5),lines))grid.text(c(0lines,3lines),unit(c(0,-3),lines),unit(c(-1,-1),lines),rot=90,just=c(right,bottom))popViewport(2)popViewport()3.5pushViewport(viewport(layout=grid.layout(3,1,heights=unit(c(1,1,1),c(null,cm,null)))))#FirstpagepushViewport(viewport(layout.pos.row=3,layout=grid.layout(3,4,widths=unit(c(2.5,1,1,1),c(cm,null,null,cm)),heights=unit(c(1,1,2.5),c(cm,null,cm)))))grid.rect(gp=gpar(col=black))for(iin2){for(jin2:3){pushViewport(viewport(layout.pos.col=j,layout.pos.row=i))grid.rect(gp=gpar(col=gray))pushViewport(plotViewport(c(2,2,1,1),xscale=c(0,11),gp=gpar(col=gray)))grid.rect(gp=gpar(col=gray))grid.text(paste(Plot,j-1))popViewport()popViewport()}}pushViewport(viewport(layout.pos.row=2,layout.pos.col=1))grid.rect(gp=gpar(col=gray,fill=lightgray))grid.text(Outer\nMargin\n2)grid.lines(c(1,1),c(0,1))grid.segments(c(1,1),c(0,1),unit(1,npc)+unit(c(.5,.5),lines),c(0,1))grid.text(0:1,unit(1,npc)+unit(c(1,1),lines),c(0,1))grid.lines(unit(1,npc)-unit(c(0,3),lines),c(0,0))grid.segments(unit(1,npc)-unit(c(0,3),lines),c(0,0),unit(1,npc)-unit(c(0,3),lines),unit(c(-.5,-.5),lines))grid.text(c(0lines,3lines),unit(1,npc)-unit(c(0,3),lines),unit(c(-1,-1),lines),rot=90,just=c(right,bottom))popViewport(2)#SecondpagepushViewport(viewport(layout.pos.row=1,layout=grid.layout(3,4,widths=unit(c(2.5,1,1,1),c(cm,null,null,cm)),heights=unit(c(1,1,2.5),c(cm,null,cm)))))grid.rect(gp=gpar(col=black))for(iin2){for(jin2:3){pushViewport(viewport(layout.pos.col=j,layout.pos.row=i))grid.rect(gp=gpar(col=gray))pushViewport(plotViewport(c(2,2,1,1),xscale=c(0,11),gp=gpar(col=gray)))grid.rect(gp=gpar(col=gray))grid.text(paste(Plot,j-1))popViewport()popViewport()}}pushViewport(viewport(layout.pos.row=3,layout.pos.col=2:3))grid.rect(gp=gpar(col=gray,fill=lightgray))grid.text(OuterMargin1)grid.lines(c(0,1),c(1,1))grid.segments(c(0,1),unit(c(1,1),npc),c(0,1),unit(c(1,1),npc)+unit(.5,lines))#grid.rect(c(0,1),#unit(c(1,1),npc)+unit(1,lines),#unit(c(1,1),strwidth,list(0,1)),#unit(c(1,1),strheight,list(0,1)),#gp=gpar(col=NULL,fill=