Learn R Programming

compositions (version 2.0-8)

segments: Draws straight lines from point to point.

Description

The function draws lines from a points x0 to a point y1 in the given geometry.

Usage

segments(x0,...)
          # S3 method for default
segments(x0,...)
          # S3 method for acomp
segments(x0,y1,...,steps=30,aspanel=FALSE)
          # S3 method for rcomp
segments(x0,y1,...,steps=30,aspanel=FALSE)
          # S3 method for aplus
segments(x0,y1,...,steps=30,aspanel=FALSE)
          # S3 method for rplus
segments(x0,y1,...,steps=30,aspanel=FALSE)
          # S3 method for rmult
segments(x0,y1,...,steps=30,aspanel=FALSE)

Arguments

x0

dataset of points (of the given type) to draw the line from

y1

dataset of points (of the given type) to draw the line to

...

further graphical parameters

steps

the number of discretisation points to draw the segments, since the representation might not visually be a straight line

aspanel

Logical, indicates use as slave to do acutal drawing only.

Author

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

Details

The default `segments.default(x0,...)` redirects to `segments` in package "graphics".

The other methods add lines to the graphics generated with the corresponding plot functions of "compositions"-classes.

Adding to multipaneled plots redraws the plot completely, and is only possible when the plot has been created with the plotting routines from this library.

See Also

plot.acomp,lines.acomp

Examples

Run this code
data(SimulatedAmounts)

plot(acomp(sa.lognormals))
segments.acomp(acomp(c(1,2,3)),acomp(c(2,3,1)),col="red")
segments.rcomp(acomp(c(1,2,3)),acomp(c(2,3,1)),col="blue")

plot(aplus(sa.lognormals[,1:2]))
segments.aplus(aplus(c(10,20)),aplus(c(20,10)),col="red")
segments.rplus(rplus(c(10,20)),rplus(c(20,10)),col="blue")

plot(rplus(sa.lognormals[,1:2]))
segments.aplus(aplus(c(10,20)),aplus(c(20,10)),col="red")
segments.rplus(rplus(c(10,20)),rplus(c(20,10)),col="blue")




Run the code above in your browser using DataLab