plotVector {jmuOutlier} | R Documentation |
Plotting Vector Addition
Description
Plots one or two 2-dimensional vectors along with their vector sum.
Usage
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 |
col |
A vector of size four, specifying the colors of the first vector, the second vector,
the vector sum, and parallel lines, respectively. Type |
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 |
las |
Numeric in (0,1,2,3); the style of axis labels. |
cex.lab |
The magnification to be used for |
cex.axis |
The magnification to be used for axis annotation. |
usr |
A vector of the form |
... |
Optional arguments to be passed to the |
Author(s)
Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA
See Also
Examples
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) )