plot_populations: Plot population(s) against time

Description Usage Arguments Examples

View source: R/plot_populations.R

Description

Plot all of the populations in a data frame against time. One column must be called "time" and will be used as the x-axis of the plot. The rest will be used as different lines on the y-axis, with a legend denoting their column names.

Usage

1
2
3
4
5
6
7
8
9
plot_populations(
  populations,
  new.graph = TRUE,
  ylim = NA,
  lty = 1,
  col = NA,
  with.legend = TRUE,
  ...
)

Arguments

populations

Data frame with columns corresponding to different population segments and a 'time' column

new.graph

(optionally) whether to start a new graph, default TRUE

ylim

(optionally, for new graphs) the limits of the y axis, default min to max pop size

lty

(optionally) the line type for the graph, default 1

col

(optionally) the colour for all lines, default 1:num.populations you can name these c(susceptibles="green", ...)

with.legend

(optionally) whether to include the legend (TRUE or FALSE), default TRUE

...

(optionally) any other arguments that plot and lines will both accept

Examples

1
2
3
df <- data.frame(time=0:100, grow=exp((0:100) / 10),
                 die=exp(seq(10, 0, by = -0.1)))
plot_populations(df, lty = 2, main = "A title")

boydorr/ProgInR documentation built on Nov. 16, 2019, 3:34 a.m.