Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vectors

Draw Labeled Vectors in 2D or 3D


Description

Graphics utility functions to draw vectors from an origin to a collection of points (using arrows in 2D or lines3d in 3D) with labels for each (using text or texts3d).

Usage

vectors(x, origin = c(0, 0), labels = rownames(x), 
    scale = 1, 
    col="blue",
    lwd=1, cex=1,
    length=.1, angle=13, pos=NULL,	
    ...)

vectors3d(x, origin=c(0,0,0), labels=rownames(x), 
    scale=1, 
    col="blue", 
    lwd=1, cex=1,
    ...)

Arguments

x

A two-column matrix or a three-column matrix containing the end points of the vectors

origin

Starting point(s) for the vectors

labels

Labels for the vectors

scale

A multiplier for the length of each vector

col

color(s) for the vectors.

lwd

line width(s) for the vectors.

cex

color(s) for the vectors.

length

For vectors, length of the edges of the arrow head (in inches).

angle

For vectors, angle from the shaft of the arrow to the edge of the arrow head.

pos

For vectors, position of the text label relative to the vector head. If pos==NULL, labels are positioned labels outside, relative to arrow ends.

...

other graphical parameters, such as lty, xpd, ...

Details

The graphical parameters col, lty and lwd can be vectors of length greater than one and will be recycled if necessary

Value

None

Author(s)

Michael Friendly

See Also

Examples

plot(c(-3, 3), c(-3,3), type="n")
X <- matrix(rnorm(10), ncol=2)
rownames(X) <- LETTERS[1:5]
vectors(X, scale=2, col=palette())

candisc

Visualizing Generalized Canonical Discriminant and Canonical Correlation Analysis

v0.8-5
GPL (>= 2)
Authors
Michael Friendly [aut, cre], John Fox [aut]
Initial release
2021-01-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.