plotVector: Plotting Vector Addition

Description Usage Arguments Author(s) See Also Examples

View source: R/plotVector.R

Description

Plots one or two 2-dimensional vectors along with their vector sum.

Usage

1
2
3
plotVector(x1, y1, x2 = NULL, y2 = NULL, add.vectors = TRUE, 
           col = c("black", "red", "darkgreen", "purple"), lwd = 8, font = 2, 
           font.lab = 2, las = 1, cex.lab = 1.3, cex.axis = 2, usr = NULL, ...)

Arguments

x1

Value on the x-axis of the first vector.

y1

Value on the y-axis of the first vector.

x2

Value on the x-axis of the second vector.

y2

Value on the y-axis of the second vector.

add.vectors

Logical; if TRUE (default), display the vector sum.

col

A vector of size four, specifying the colors of the first vector, the second vector, the vector sum, and parallel lines, respectively. Type colors() for selections.

lwd

The line width of the vectors.

font

An integer specifying which font to use for text.

font.lab

The font to be used for x and y labels.

las

Numeric in (0,1,2,3); the style of axis labels.

cex.lab

The magnification to be used for x and y labels.

cex.axis

The magnification to be used for axis annotation.

usr

A vector of the form c(x1, x2, y1, y2) giving the extremes of the user coordinates of the plotting region.

...

Optional arguments to be passed to the plot function (see par).

Author(s)

Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA

See Also

plot and curve.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
par( mfrow=c(2,2) )

# Vectors (2,8) and (4,-3) and their vector sum.
     plotVector( 2, 8, 4, -3 ) 
     
# Colinear vectors (-3,6) and (-1,2).
     plotVector( -3, 6, -1, 2, add=FALSE, col=c("red","black") )

# Colinear vectors (-1,2) and (3,-6).
     plotVector( -1, 2, 3, -6, add=FALSE )

# Vectors (2,3) and (5,-4)
     plotVector( 2, 3, 5, -4, add=FALSE, usr=c( -5, 5, -4, 7) )

par( mfrow=c(1,1) )

jmuOutlier documentation built on Aug. 6, 2019, 1:03 a.m.