Thanks for all your help. For documentation (I'm probably not the last one searching R-help for a solution to this problem), here is what I believe works best for the intended purouse:
x<-0:10; y<-x^4; library(gridBase) X11(width=8,height=8) # produce outer ("main") plot plot(x,y,xaxs="i",yaxs="i") vp <- baseViewports() pushViewport(vp$inner,vp$figure,vp$plot) # push viewport that will contain the inset pushViewport(viewport(x=0.1,y=0.9,width=.5,height=.5,just=c("left","top"))) # now either define viewport to contain the whole inset figure par(fig=gridFIG(),new=T) # or gridPLT() # ...or just the plotting are (coordinate system) par(plt=gridPLT(),new=T) # draw frame around selected area (for illustration only) grid.rect(gp=gpar(lwd=3,col="red")) # plot inset figure plot(x,y,xaxs="i",yaxs="i",xlab="",ylab="") # pop all viewports from stack popViewport(4) Pascal Niklaus > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges > > Sent: Tuesday, December 06, 2005 1:54 AM > > To: [EMAIL PROTECTED] > > Cc: r-help@stat.math.ethz.ch > > Subject: Re: [R] figure with inset > > > > [EMAIL PROTECTED] wrote: > > > > > I am trying to plot a figure within a figure (an inset that > > shows a closeup of > > > part of the data set). I have searched R-help and other > > sources but not found a > > > solution. > > > > See the examples on the grid package by Paul Murrel in R News. > > > > Uwe Ligges > > > > 1. Nice posting -- Your little diagram makes your question crystal clear. > > 2. Murrell's new book, R GRAPHICS, is a comprehensive resource on grid, if > you decide you want to do more with it. > > 3. See also ?par ... new=TRUE for a (less flexible, but perhaps adequate > for your needs) way to do this in R's traditional graphics system. > > Cheers, > Bert > > > > > > > What I would like to do is > > > > > > (1) produce a plot > > > (2) specify a window that will be used for the next plot > > (in inches or using the > > > coordinate system of the plot produced in (1) > > > (3) overlay a new plot in the window specified under (2) > > > > > > The result would be: > > > > > > +----------------------+ > > > | | > > > | first plot | > > > | +--------+ | > > > | | inset | | > > > | +--------+ | > > > | | > > > +----------------------+ > > > > > > Thank you for your help > > > > > > Pascal > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html