flowchart | R Documentation |
generate the flow chart for a compartmental model
flowchart(model, tex, ..., preambles = NULL)
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. |
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.
a character holding a tikzpicture latex environment.
# 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))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.