plot_mutualism_portrait: Plot phase portrait for mutualism model

View source: R/mutualism.R

plot_mutualism_portraitR Documentation

Plot phase portrait for mutualism model

Description

Generate a phase portrait for the model of mutualism with saturating functional response.

Usage

plot_mutualism_portrait(sim_df, vec = TRUE, traj = TRUE, ...)

Arguments

sim_df

Data frame of mutualism model simulation returned by run_mutualism().

vec

Logical. If TRUE (default), a vector field will be drawn.

traj

Logical. If TRUE (default), trajectories of population sizes in sim_df will be drawn.

...

Arguments passed on to mutualism_vector_field

vec.density

Density of vectors, specified as a single numeric value larger than 0. e.g. If vec.density = 20 (default), a 20 \times 20 point grid evenly spaced along each axis is generated, where each grid point is the starting point of a vector.

vec.scale

Value to scale magnitude of vectors by, specified as a single numeric value larger than 0. e.g. If vec.scale = 0.1 (default) the magnitude of each vector is 0.1 times the magnitude of the vector produced by running run_mutualism() for one time step given each starting point (specified via vec.density) and params (inherited from sim_df).

Value

A ggplot object with population sizes (N1, N2) plotted against one another as a phase portrait. Zero net growth isoclines for each species are also plotted. Optionally, a vector field and/or trajectories of population sizes can also be plotted.

Note

The plot generated with this function is constrained to display only the first quadrant (i.e. values of 0 and above) of the phase plane defined by N1 and N2 because negative values of N do not make biological sense. As a consequence, when sim_df is generated using negative values for r1 and/or r2, the corresponding zero net growth isoclines may not be visible in the plot if they lie largely beyond the plot's limits.

See Also

run_mutualism(), plot_mutualism_time()

Examples

# Plot phase portrait with vector field and population trajectories
sim <- run_mutualism()
plot_mutualism_portrait(sim)

# Plot phase portrait without vector field
sim <- run_mutualism()
plot_mutualism_portrait(sim, vec = FALSE)

# Plot phase portrait without population trajectories
sim <- run_mutualism()
plot_mutualism_portrait(sim, traj = FALSE)

# Customize vector field
sim <- run_mutualism()
plot_mutualism_portrait(sim, vec.density = 10, vec.scale = 0.2)

gauravsk/ecoevoapps documentation built on July 9, 2024, 9:37 p.m.