Hi, I need to draw a line segment between two points on different plots in the same multigraph.I've tried looking at the zoominplot function in plotrix but havent understood much.any help is appreciated ~Aks [[alternative HTML version deleted]]
Hi, You should give a minimal reproducible example so that we know more precisely what you want to do (what's a "multigraph"?). Perhaps you can get inspiration from Paul Murrell's R graphics book, in particular Figure 5.22, http://www.stat.auckland.ac.nz/~paul/RGraphics/customgrid-latticeingrid.png But that requires using Grid graphics as opposed to base graphics. Perhaps the gridBase package can help in this regard. Hope this helps, baptiste On 16 Apr 2009, at 11:57, rajesh j wrote:> Hi, > > I need to draw a line segment between two points on different plots > in the > same multigraph.I've tried looking at the zoominplot function in > plotrix but > havent understood much.any help is appreciated > > ~Aks > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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._____________________________ Baptiste Augui? School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag
Here's an example adapted from ?grid.arrows pushViewport(viewport(layout=grid.layout(1, 2))) pushViewport(viewport(layout.pos.col=1, layout.pos.row=1)) grid.rect(gp=gpar(col="grey")) grid.points() grid.points(x=0.5, y=0.5, gp=gpar(col="red")) popViewport() pushViewport(viewport(layout.pos.col=2, layout.pos.row=1)) grid.rect(gp=gpar(col="grey")) grid.points() grid.points(x=0.5, y=0.7, gp=gpar(col="blue")) grid.move.to(x=0.5, y=0.7) popViewport() pushViewport(viewport(layout.pos.col=1, layout.pos.row=1)) glt <- lineToGrob(x=0.5, y=0.5, gp=gpar(lwd=3)) grid.arrows(grob=glt, ends="first", gp=gpar(lwd=3)) popViewport(2) I don't know how to do this in base R. Next time you reply, can you please Cc: the r-help list? baptiste On 16 Apr 2009, at 12:11, rajesh j wrote:> multigraph has several graphs in 1 layout.I'm drawing a large graph > and plotting small portions of it below.I'm drawing lines from the > large graph to the smaller ones to show which part of the large > graph it is. > > On Thu, Apr 16, 2009 at 4:34 PM, baptiste auguie > <ba208@exeter.ac.uk> wrote: > Hi, > > You should give a minimal reproducible example so that we know more > precisely what you want to do (what's a "multigraph"?). > > Perhaps you can get inspiration from Paul Murrell's R graphics book, > in particular Figure 5.22, > > http://www.stat.auckland.ac.nz/~paul/RGraphics/customgrid-latticeingrid.png > > > But that requires using Grid graphics as opposed to base graphics. > Perhaps the gridBase package can help in this regard. > > Hope this helps, > > baptiste > > > > > On 16 Apr 2009, at 11:57, rajesh j wrote: > > Hi, > > I need to draw a line segment between two points on different plots > in the > same multigraph.I've tried looking at the zoominplot function in > plotrix but > havent understood much.any help is appreciated > > ~Aks > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > > _____________________________ > > Baptiste AuguiƩ > > School of Physics > University of Exeter > Stocker Road, > Exeter, Devon, > EX4 4QL, UK > > Phone: +44 1392 264187 > > http://newton.ex.ac.uk/research/emag > ______________________________ > > > > > -- > Rajesh.J > >_____________________________ Baptiste AuguiƩ School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag ______________________________ [[alternative HTML version deleted]]
The help page for the cnvrt.coords function in the TeachingDemos package shows some examples of drawing lines/rectangles between multiple graphs created using par(mfrow=c(... This function and the examples were written before the grconvertX and grconvertY functions, so use the example for the general idea, but it is better to use the grconvert functions rather than cnvrt.coords. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of rajesh j > Sent: Thursday, April 16, 2009 4:58 AM > To: r-help at r-project.org > Subject: [R] segment between points on different plots > > Hi, > > I need to draw a line segment between two points on different plots in > the > same multigraph.I've tried looking at the zoominplot function in > plotrix but > havent understood much.any help is appreciated > > ~Aks > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.