phaseArrows: phaseArrows

Description Usage Arguments Value Author(s) Examples

Description

plotting phase space vectors

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
phaseArrows(fDeriv, xlims = c(-3, 3), ylims = xlims, resol = 20, 


    isJitter = FALSE, add = F, arrowHeads = 0.04, arrowLength = 0.5, 


    col = rev(heat.colors(150))[-(1:50)], logLength = FALSE, 


    dimnames = NULL, ...)

Arguments

fDeriv

derivative function function(x,y,...)

xlims

numeric vector (2): range of the x values

ylims

numeric vector (2): range of the y values

resol

scalar integer: number of points in x and y range

isJitter

set to TRUE to jitter vector starting positions to avoid overplotting

(however calculating contours does not work then anymore)

add

set to TRUE to add arrows to an existing plot

arrowHeads

size of the arrow heads (in inches), set t0 0 for heads, 0.04 gives nice results

arrowLength

length of the vectors, set to 0 to scale vectors with magnitude of flow

col

color scale

logLength

set to TRUE to calculate colors or length for log of the flow strength

dimnames

character vector(2): labels of the x and y axis, to overwrite defaults

...

further arguments to fun, such as parms

Value

result of evalDerivGrid: a list with entries

Author(s)

Thomas Wutzler

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
fDeriv <- predatorprey(lambda=3, epsilon=2, delta=3, eta=2)


#


# set up a plotting window


# windows(width = 4.6, height = 3.2, pointsize = 10); par( las = 1, mar = c(2, 3.3, 0, 0) + 0.3, tck = 0.02, mgp = c(1.1, 0.2, 0))


#


# default: strength is colored, no arrow heads, same length


tmp <- phaseArrows( fDeriv, c(-2,5),c(-2,5) );


#phaseContours(tmp$z, tmp$xy, add=TRUE)


phaseNullclines(tmp$z, tmp$xy, add=TRUE)


drawTrajectories( fDeriv, tEnd=3, x0=list(x=1,y=2) )    # initial starting point by script


#drawTrajectories( fDeriv, tEnd=3, x0=locator(2,"p") )   # set the starting point in the graph: need to click several times


#


# add arrow heads and use colors for log scale, scale vector length


phaseArrows( fDeriv, c(-2,5),c(-2,5), logLength=TRUE, arrowHeads=0.04, arrowLength=0 );


#


# for background, sometimes a decent color is useful


tmp <- phaseArrows( fDeriv, c(-2,5),c(-2,5), col="grey" );


#


# may use parallel calculation of flow field and trajectories


if( FALSE ){    # do not run on R CMC check


    require(snowfall)


    tmp <- phaseArrows( fDeriv, c(-2,5),c(-2,5), useSnowfall=TRUE );       # using parallel calculation


    drawTrajectories( fDeriv, tEnd=3, x0=list(x=1,y=c(2:5)), fLapply=sfLapply )    # initial starting point by script


}

pplane documentation built on May 2, 2019, 6:07 p.m.