Skip to contents

Plot demographic history encoded in a slendr model

Usage

plot_model(
  model,
  sizes = TRUE,
  gene_flow = c("all", "arrows", "none"),
  log = FALSE,
  order = NULL,
  file = NULL,
  schedule = NULL,
  ...,
  proportions = NULL
)

Arguments

model

Compiled slendr_model model object

sizes

Should population size changes be visualized?

gene_flow

Should gene-flow arrows be labeled with the associated values ("all", the default), only on their own ("arrows"), or not at all ("none")?

log

Should the y-axis be plotted on a log scale? Useful for models over very long time-scales.

order

Order of the populations along the x-axis, given as a character vector of population names. If NULL (the default), the default plotting algorithm will be used, ordering populations from the most ancestral to the most recent using an in-order tree traversal.

file

Output file for a figure saved via ggsave

schedule

Recording schedule to be visualized over the model

...

Optional argument which will be passed to ggsave

proportions

Deprecated (see the gene_flow argument).

Value

A ggplot2 object with the visualized slendr model

Examples

init_env()

# load an example model with an already simulated tree sequence
path <- system.file("extdata/models/introgression", package = "slendr")
model <- read_model(path)

plot_model(model, sizes = FALSE, log = TRUE)