drawDirectionField {oce}R Documentation

Draw a Direction Field

Description

The direction field is indicated variously, depending on the value of type:

Usage

drawDirectionField(x, y, u, v, scalex, scaley, length = 0.05, add = FALSE,
  type = 1, col = par("fg"), pch = 1, cex = par("cex"),
  lwd = par("lwd"), lty = par("lty"), debug = getOption("oceDebug"))

Arguments

x, y

coordinates at which velocities are specified.

u, v

velocity components in the x and y directions.

scalex, scaley

scale to be used for the velocity arrows. Exactly one of these must be specified. Arrows that have u^2+v^2=1 will have length scalex along the x axis, or scaley along the y axis, according to which argument is given.

length

indication of width of arrowheads. The somewhat confusing name of this argument is a consequence of the fact that it is passed to arrows for drawing arrows. Note that the present default is smaller than the default used by arrows.

add

if TRUE, the arrows are added to an existing plot; otherwise, a new plot is started by calling plot with x, y and type="n". In other words, the plot will be very basic. In most cases, the user will probably want to draw a diagram first, and add the direction field later.

type

indication of the style of arrow-like indication of the direction.

col

colour of line segments or arrows

pch, cex

plot character and expansion factor, used for type=1

lwd, lty

line width and type, used for type=2

debug

debugging value; set to a positive integer to get debugging information.

Value

None.

Author(s)

Dan Kelley

Examples

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)

[Package oce version 0.9-21 Index]