flowchart: generate the flow chart for a compartmental model

View source: R/flowchart.R

flowchartR Documentation

generate the flow chart for a compartmental model

Description

generate the flow chart for a compartmental model

Usage

flowchart(model, tex, ..., preambles = NULL)

Arguments

model

an object of Compartmental class

tex

an object of TexFormatter class

...

the tikz commands. Compartment descriptions and transition descriptions must be given by named arguments, which names must be the name for the compartment or transition, and the value is a description given by Node and Arc functions.

preambles

a character holding a sequence of latex commands as latex preambles.

Details

When calling the Node function, the name and label of the compartment does not need to be passed. The name it is given as the name of the argument. The label is generated using tex. Similarly, when calling Arc, the from, to and rate need not be specified.

Value

a character holding a tikzpicture latex environment.

Examples

# an SIR model
SIR = Compartmental$new(S, I, R, title="SIR")
SIR$transition(S->I ~ beta*S*I/N, N=S+I+R, name="infection")
SIR$transition(I->R ~ gamma*I, name="recovery")
flowchart(SIR, TexFormatter$new(),
  S=Node(at=c(0,0)),
  I=Node(at=c(2,0)),
  R=Node(at=c(4,0))
)

junlingm/REpiSim documentation built on Nov. 28, 2023, 2:35 a.m.