I would like to do as follows plot(a,b) points(c,d,pch=19) Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] All corresponding points from the two data sets are joined by line segments. Thanks very much for any tips on how to do this. Bill
Try:> segments(a,b,c,d)-- 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 William Simpson > Sent: Thursday, February 26, 2009 1:46 PM > To: r-help at r-project.org > Subject: [R] plot with pairwise joined points > > I would like to do as follows > plot(a,b) > points(c,d,pch=19) > > Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], > b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] > > All corresponding points from the two data sets are joined by line > segments. > > Thanks very much for any tips on how to do this. > > Bill > > ______________________________________________ > 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.
have a look at segments(), e.g., x <- rnorm(5) y <- rnorm(5) z <- rnorm(5) w <- rnorm(5) r1 <- range(x, z) r2 <- range(y, w) plot(r1, r2, type = "n") points(x, y) points(z, w, pch = 19) segments(x, y, z, w) I hope it helps. Best, Dimitris William Simpson wrote:> I would like to do as follows > plot(a,b) > points(c,d,pch=19) > > Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], > b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] > > All corresponding points from the two data sets are joined by line segments. > > Thanks very much for any tips on how to do this. > > Bill > > ______________________________________________ > 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. >-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014
On 27/02/2009, at 9:46 AM, William Simpson wrote:> I would like to do as follows > plot(a,b) > points(c,d,pch=19) > > Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], > b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] > > All corresponding points from the two data sets are joined by line > segments.?segments cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
Thanks very much Rolf, Dimitris, & Greg! Bill On Thu, Feb 26, 2009 at 8:56 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:> > On 27/02/2009, at 9:46 AM, William Simpson wrote: > >> I would like to do as follows >> plot(a,b) >> points(c,d,pch=19) >> >> Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], >> b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] >> >> All corresponding points from the two data sets are joined by line >> segments. > > ?segments > > cheers, > > Rolf Turner > > ###################################################################### > Attention:This e-mail message is privileged and confidential. If you are not > theintended recipient please delete the message and notify the sender.Any > views or opinions presented are solely those of the author. > > This e-mail has been scanned and cleared by > MailMarshalwww.marshalsoftware.com > ###################################################################### >