Hi
Lorenzo Isella wrote: > Dear All, > I ma having a trouble in generating a figure containing 3 insets with > the gridBase package. > I always get an error message of the kind: > > Error in gridPLT() : Figure region too small and/or viewport too large > > No matter which parameters I choose. The plots works nicely with two > insets only, but when I try adding the third one, my troubles begin. > I am probably doing something wrong in the generation of the 3rd inset > and I paste below everything I do in this (a bit complicated) figure. > Any suggestion is welcome. The error means that you are creating a region that is too small. Try setting the width and height of the PDF to something big and your code might work and you might be able to see why the region is too small at the default size. To get more help, you'll have to simplify your code example and/or post some data so that we can run your code. Paul > Cheers > > Lorenzo > > > pdf("./post-processing-plots/exploratory_research_figure_2.pdf") > par( mar = c(4.5,5, 2, 1) + 0.1) > plot(time[1:time_end],tot_num_150[1:time_end]/1e6,type="b",lwd=2,col="blue",lty=2, > xlab=expression(paste(tau,"[s]")), > ylab=expression(paste("N[", > cm^{-3},"]")),cex.lab=1.6,ylim=range(c(7.4e7,1.43e8)),yaxt="n",cex.axis=1.4) > #lines(time[1],ini_pop/1e6, "p",col="red",lwd=2,lty=1,pch=5 ) > lines(time[time_end],8.25e7, "p",col="red",lwd=2,lty=1,pch=5) > > axis(side=2, at=c( 7.4e7, 9.6e7, 1.18e8, 1.4e8), > labels=expression(7.4%*%10^7, 9.6%*%10^7, > 1.18%*%10^8,1.4%*%10^8),cex.lab=1.6,cex.axis=1.4) > #axis(side=1,cex.axis=1.4) > ## lines(time[1:time_end], > N_approx[1:time_end],col="red",type="b",lwd=2,lty=1,pch=4) > ## lines(time[1:time_end], > N_approx2[1:time_end],col="black",type="b",lwd=2,lty=1,pch=2) > ## lines(time[1:time_end], > N_approx_beta1[1:time_end,2],col="brown",type="b",lwd=2,lty=1,pch=5) > legend("topright",cex=1.2, c(expression("Simulation"), > expression("Outlet measurement")), > lwd=c(2,2),lty=c(2,0),pch = c(1,5),col=c("blue", "red"),box.lwd=0,box.lty=0, > ,xjust = 1, yjust = 1) > # abline(v=time[12],lwd=2,pch=2,lty=2) > lines(c(time[14],time[14]), c(0,1.2e8),lwd=2,lty=2,pch=2) > # legend(-0.2,9.2e7,cex=1.2,c(expression("numerical result for a > 5m-long pipe")),bty="n") > arrows(0.8, 9e7, time[14], tot_num_150[14]/1e6, length = 0.15,lwd=2) > text(0.8,8.8e7,cex=1.2,"Final concentration for a") > text(0.8,8.5e7,cex=1.2,"6.5m long transfer tube (LAT)") > > text(0.8,8e7,cex=1.2,"Final concentration for a") > text(0.68,7.7e7,cex=1.2,"9m long transfer tube") > text(0.8,7.4e7,cex=1.2,"(VELA)") > > text(1.3,1.24e8,cex=1.2,"Residence time for") > text(1.3,1.21e8,cex=1.2,"a 6.5m long transfer tube") > > > arrows(1.1, 7.7e7, time[21], 7.7e7, length = 0.,lwd=2) > arrows( time[21], 7.7e7, time[21], tot_num_150[21]/1e6, length = 0.15,lwd=2) > > > > par( mar = c(0.,0., 0., 0.) ) > > > #1st inset > > vp <- baseViewports() > pushViewport(vp$inner,vp$figure,vp$plot) > pushViewport(viewport(x=-0.0,y=1.04,width=.4,height=.4,just=c(0,1))) > > par(fig=gridPLT(),new=F) > > #grid.rect(gp=gpar(lwd=0,col="red")) > > plot(D_mean,data_150[1, ]/log_factor*log(10)/1e6,"l", > pch=1,col="black", lwd=2,xlab="",ylab="" > ,cex.axis=1.,cex.lab=1.,log="x",xaxt="n",yaxt="n", > ylim=range(c(0, 2.4e8))) > > ## axis(side=2, at=c( 0, 0.6e8, 1.2e8, 1.8e8, 2.4e8), > ## labels=expression(0, 6%*%10^7, 1.2%*%10^8, > 1.8%*%10^8,2.4%*%10^8),cex.lab=1.4,cex.axis=1.2) > > > #2nd inset > > #vp <- baseViewports() > pushViewport(vp$inner,vp$figure,vp$plot) > pushViewport(viewport(x=0.5,y=0.65,width=.4,height=.4,just=c(0,1))) > > par(fig=gridPLT(),new=F) > > #grid.rect(gp=gpar(lwd=0,col="red")) > > plot(D_mean,data_150[21, ]/log_factor*log(10)/1e6,"l",lwd=2, > pch=1,col="black",xlab="",ylab="", log="x" > ,cex.axis=1.4,cex.lab=1.6,xaxt="n",yaxt="n",ylim=range(c(0, 2.4e8))) > > > > #3rd inset > > #vp <- baseViewports() > pushViewport(vp$inner,vp$figure,vp$plot) > pushViewport(viewport(x=0.25,y=0.7,width=.4,height=.4,just=c(0,1))) > > par(fig=gridPLT(),new=T) > > #grid.rect(gp=gpar(lwd=0,col="red")) > > plot(D_mean,data_150[14, ]/log_factor*log(10)/1e6,"l",lwd=2, > pch=1,col="black",xlab="",ylab="", log="x" > ,cex.axis=1.4,cex.lab=1.6,xaxt="n",yaxt="n",ylim=range(c(0, 2.4e8))) > > > popViewport(3) > > > dev.off() > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.