VecDecomPlot: Plotting function for vector decomposition and remainder...

Description Usage Arguments Details Examples

View source: R/VecDecomPlot.R

Description

This function plots various vector fields

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
VecDecomPlot(
  x.field,
  y.field,
  dens,
  x.bound,
  y.bound,
  xlim = NULL,
  ylim = NULL,
  arrow.type = "equal",
  tail.length = 0.25,
  head.length = 0.25,
  xlab = "X",
  ylab = "Y",
  ...
)

Arguments

x.field

a two-dimensional array containing the x-values for the vector field, generated from VecDecomAll, VecDecomVec, VecDecomGrad, or VecDecomRem.

y.field

a two-dimensional array containing the y-values for the vector field, generated from VecDecomAll, VecDecomVec, VecDecomGrad, or VecDecomRem.

dens

two-element vector respectively specifying the number of respective arrows in the x and y directions.

x.bound

the x boundaries denoted at c(minimum, maximum) for the quasi-potential simulation.

y.bound

the y boundaries denoted at c(minimum, maximum) for the quasi-potential simulation.

xlim

numeric vectors of length 2, giving the x coordinate range. Default = NULL automatically sizes plot window.

ylim

numeric vectors of length 2, giving the y coordinate range. Default = NULL automatically sizes plot window.

arrow.type

sets the type of line segments plotted. If set to "proportional" the length of the line segments reflects the magnitude of the derivative. If set to "equal" the line segments take equal lengths, simply reflecting the gradient of the derivative(s). Defaults to "equal".

tail.length

multiplies the current length of the tail (both proportional and equal arrow.types) by the specified factor. The argument defaults to 1, which is length of the longest vector within the domain boundaries (i.e., the entire field).

head.length

length of the edges of the arrow head (in inches).

xlab

label for x axis. Default is 'X'

ylab

label for y axis. Default is 'Y'

...

passes arguments to both plot.

Details

If arrow.type = "proportional", a common warning, passed from arrows, will appear: "The direction of a zero-length arrow is indeterminate, and hence so is the direction of the arrowheads. To allow for rounding error, arrowheads are omitted (with a warning) on any arrow of length less than 1/1000 inch." Either increase tail.length or increase the plot window to avoid this warning.

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
40
41
42
43
44
45
46
# First, system of equations
	equationx <- "1.54*x*(1.0-(x/10.14)) - (y*x*x)/(1.0+x*x)"
	equationy <- "((0.476*x*x*y)/(1+x*x)) - 0.112590*y*y"

# Second, shared parameters for each quasi-potential run
	xbounds <- c(-0.5, 10.0)
	ybounds <- c(-0.5, 10.0)
	xstepnumber <- 100
	ystepnumber <- 100

# Third, first local quasi-potential run
	xinit1 <- 1.40491
	yinit1 <- 2.80808
	storage.eq1 <- QPotential(x.rhs = equationx, x.start = xinit1, 
	x.bound = xbounds, x.num.steps = xstepnumber, y.rhs = equationy, 
	y.start = yinit1, y.bound = ybounds, y.num.steps = ystepnumber)

# Fourth, second local quasi-potential run
	xinit2 <- 4.9040
	yinit2 <- 4.06187
	storage.eq2 <- QPotential(x.rhs = equationx, x.start = xinit2, 
	x.bound = xbounds, x.num.steps = xstepnumber, y.rhs = equationy, 
	y.start = yinit2, y.bound = ybounds, y.num.steps = ystepnumber)

# Fifth, determine global quasi-potential 
	unst.x <- c(0, 4.2008)
	unst.y <- c(0, 4.0039)
	ex1.global <- QPGlobal(local.surfaces = list(storage.eq1, storage.eq2), 
	unstable.eq.x = unst.x, unstable.eq.y = unst.y, x.bound = xbounds, 
	y.bound = ybounds)

# Sixth, decompose the global quasi-potential into the 
# deterministic skeleton, gradient, and remainder vector fields
	VDAll <- VecDecomAll(surface = ex1.global, x.rhs = equationx, y.rhs = equationy, 
	x.bound = xbounds, y.bound = ybounds)

# Seventh, plot all three vector fields
	# The deterministic skeleton vector field
	VecDecomPlot(x.field = VDAll[,,1], y.field = VDAll[,,2], dens = c(25,25), 
	x.bound = xbounds, y.bound = ybounds, tail.length = 0.25, head.length = 0.05)
	# The gradient vector field
	VecDecomPlot(x.field = VDAll[,,3], y.field = VDAll[,,4], dens = c(25,25), 
	x.bound = xbounds, y.bound = ybounds, tail.length = 0.15, head.length = 0.05)
	# The remainder vector field
	VecDecomPlot(x.field = VDAll[,,5], y.field = VDAll[,,6], dens = c(25,25), 
	x.bound = xbounds, y.bound = ybounds, tail.length = 0.15, head.length = 0.05)

bmarkslash7/QPot documentation built on Jan. 11, 2020, 11:11 a.m.