Description Usage Arguments Details Value Author(s) Examples
The direction field is indicated variously, depending on the value of
type
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 
x, y 
coordinates at which velocities are specified. The
length of 
u, v 
velocity components in the x and y directions. Can be
either vectors with the same length as 
scalex, scaley 
scale to be used for the velocity arrows.
Exactly one of these must be specified. Arrows that have

skip 
either an integer, or a twoelement vector indicating
the number of points to skip when plotting arrows (for the
matrix 
length 
indication of width of arrowheads. The
somewhat confusing name of this argument is a consequence of
the fact that it is passed to 
add 
if 
type 
indication of the style of arrowlike indication of the direction. 
col 
color of line segments or arrows; see 
pch, cex 
plot character and expansion factor, used for

lwd, lty 
line width and type, used for 
xlab, ylab 

debug 
debugging value; set to a positive integer to get debugging information. 
... 
other arguments to be passed to plotting functions (e.g. axis labels, etc). 
For type=1
, each indicator is drawn with a symbol, according to the
value of pch
(either supplied globally, or as an element of the
...
list) and of size cex
, and color col
. Then, a
line segment is drawn for each, and for this lwd
and col
may
be set globally or in the ...
list.
For type=2
, the points are not drawn, but arrows are drawn instead
of the line segments. Again, lwd
and col
control the type of
the line.
None.
Dan Kelley and Clark Richards
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  library(oce)
plot(c(1.5, 1.5), c(1.5, 1.5), xlab="", ylab="", type='n')
drawDirectionField(x=rep(0, 2), y=rep(0, 2), u=c(1, 1), v=c(1, 1), scalex=0.5, add=TRUE)
plot(c(1.5, 1.5), c(1.5, 1.5), xlab="", ylab="", type='n')
drawDirectionField(x=rep(0, 2), y=rep(0, 2), u=c(1, 1), v=c(1, 1), scalex=0.5, add=TRUE,
type=2)
## 2D example
x < seq(2, 2, 0.1)
y < x
xx < expand.grid(x, y)[,1]
yy < expand.grid(x, y)[,2]
z < matrix(xx*exp(xx^2 yy^2), nrow=length(x))
gz < grad(z, x, y)
drawDirectionField(x, y, gz$gx, gz$gy, scalex=0.5, type=2, len=0.02)
oceContour(x, y, z, add=TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.