Segments | R Documentation |
Draw line segments between pairs of points from a vector, matrix or data frame of 4 points coordinates x0, y0, x1, y1
Segments(mydata, ...)
mydata |
a vector, matrix or data frame |
... |
further graphical parameters (from 'par') |
a wrapper to 'segments' to handle coordinates passed as vector, matrix or data frame. Any vector is turned into a matrix of four columns.
segments
mydata<-cbind(rnorm(20),rnorm(20),rnorm(20),rnorm(20))
plot(range(rbind(mydata[,1],mydata[,3])),range(rbind(mydata[,2],mydata[,4])),
type="n",xlab="",ylab="")
Segments(mydata,col=rainbow(20))
myvec<-rnorm(4)
plot(myvec[c(1,3)],myvec[c(2,4)],type="n",xlab="",ylab="")
Segments(myvec)
myvec<-rnorm(16)
plot(myvec,myvec,type="n",xlab="",ylab="")
Segments(myvec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.