QPContour: Contour plot of quasi-potential surfaces

Description Usage Arguments Details Examples

View source: R/QPContour.R

Description

This function allows users to create a contour plot of quasi-potential surfaces from QPGlobal

Usage

1
2
3
QPContour(surface, dens, x.bound, y.bound, xlim = NULL, ylim = NULL,
  n.filled.contour = 25, n.contour.lines = 25, c.parm = 1, col.contour,
  contour.lines = TRUE, xlab = "X", ylab = "Y", contour.lwd = 1, ...)

Arguments

surface

the surface to be plotted, from QPGlobal.

dens

vector respectively for the number of x and y points to be plotted.

x.bound

a two-element vector with the minimum and maximum x values used for computing the quasi-potential.

y.bound

a two-element vector with the minimum and maximum y values used for computing the quasi-potential.

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.

n.filled.contour

numeric value for the nubmber of breaks in the filled contour.

n.contour.lines

numeric value for the number of breaks in the contour lines.

c.parm

contour line adjustment (see details).

col.contour

colors to interpolate; must be a valid argument to col2rgb.

contour.lines

if TRUE, then contour lines plotted over filled contour; vice versa if FALSE.

xlab

a title for the x axis. Default is 'X'

ylab

a title for the y axis. Default is 'Y'

contour.lwd

line width of contour lines.

...

passes arguments to plot.

Details

Because, in general, capturing the topological features of a surface can be subtle, we implemented a feature in QPContour to keep the filled contour region while changing the contour lines. Specifically, filled.contour takes the range of the surface values (φ), divides by the number of the specified contours (i.e., n.filled.contour), and creates a contour at each break, which happenes to be equal across the range. But because visualizing some topology may (i) require looking between contour breaks and (ii) adding contour lines would overload the plot with lines, we use an equation to modify the distribution of contour lines. Namely, adjusting the c argument in the QPContour function adjusts the c paramter in the following equation:

max_φ \times ≤ft(\frac{x}{n-1}\right)^c.

This allows the user to keep the same number of contour lines (i.e., specified with n.contour.lines), but focus them toward the troughs or peaks of the surfaces. At c=1, the contour lines correspond to the filled.contour breaks. If c > 1, then the contour lines become more concentrated towards the trough. Similarly, if c < 1, then the contour lines are more focused at the peaks of the surface. As an example, we change c :
Example3.png.

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
# 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 <- 150
	ystepnumber <- 150

# 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, contour of the quasi-potential
	QPContour(ex1.global, dens = c(100,100), x.bound = xbounds, 
	y.bound = ybounds, c.parm = 5)

QPot documentation built on May 2, 2019, 2:34 p.m.