Vector velocity plot.
Description
Displays (velocity) vectors as segments.
Usage
1 2 3 4 
Arguments
u 
A vector with quantities (velocities) in xdirection. 
v 
A vector with quantities (velocities) in ydirection.
Should have the same length as 
x 
A vector with xaxis values. If 
y 
The yaxis value. One number, or a vector of length = u. 
colvar 
The variable used for coloring. It need
not be present, but if specified, it should be a vector of
dimension equal to 
col 
Colors to be used for coloring the arrows as specified by the

NAcol 
Colors to be used for 
breaks 
a set of finite numeric breakpoints for the colors; must have one more breakpoint than color and be in increasing order. Unsorted vectors will be sorted, with a warning. 
colkey 
A logical, The default is to draw the color key on side = 4, i.e. in the right margin.
If 
clim 
Only if 
clab 
Only if 
by 
Number increment for plotting vectors.
Set this to an integer > 
xfac 
Only for 
arr 
If 
add 
If 
... 
additional arguments passed to the plotting methods. 
Value
none
See Also
quiver2D, flowpath, for other functions to plot velocities.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  # save plotting parameters
mf < par("mfrow")
## =======================================================================
## EXAMPLE 1:
## =======================================================================
par(mfrow = c(2, 2))
u < cos(seq(0, 2*pi, 0.1))
v < sin(seq(0, 2*pi, 0.1)+ 1)
vectorplot(u = u, v = v)
vectorplot(u = u, v = v, col = 1:10)
x < seq(0, 1, length.out = length(u))
vectorplot(u = u, v = v, x = x, xfac = 3)
points(x, rep(0, length(u)), pch = "+", col = "red")
vectorplot(u = u, v = v, x = 1:length(u), xfac = 10)
## =======================================================================
## EXAMPLE 2: adding to a plot
## =======================================================================
par(mfrow = c(2, 2))
x < 1:length(u)
plot(x, u)
vectorplot(u = u, v = v, x = x, xfac = 10,
add = TRUE, col = "red")
vectorplot(u = u, v = v, x = x, xfac = 10,
colvar = sqrt(u^2+v^2), clab = "m/s")
vectorplot(u = u, v = v, x = x, xfac = 10,
colvar = sqrt(u^2+v^2), clab = "m/s", log = "c")
# reset plotting parameters
par(mfrow = mf)
