make_diagram | R Documentation |
make_diagram()
generates a ggplot2 object based on the data frames
made with prepare_diagram
and, optionally, updated with
update_diagram
.
make_diagram(diagram_list, with_grid = FALSE)
diagram_list |
A required list of data frames returned from the
|
with_grid |
A logical indicating whether to return the ggplot with a grid. Default is FALSE. The grid can be helpful if you want/need to move items around. |
This function uses all the information in the data frames list
generated by prepare_diagram
and, optionally, updated with
update_diagram
to make a ggplot2
object. All location
information and aesthetics are assumed fixed at this point – no updates
are made within this function. The underlying ggplot2
code can be
viewed by typing make_diagram
with no parentheses in the R console.
A ggplot2 object.
mymodel = list(variables = c("S","I","R"),
flows = list(S_flows = c("-b*S*I"),
I_flows = c("b*S*I","-g*I"),
R_flows = c("g*I") ) )
diagram_list <- prepare_diagram(model_list = mymodel)
# make diagram without grid
diagram <- make_diagram(diagram_list)
# make diagram with grid
diagram_with_grid <- make_diagram(diagram_list, with_grid = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.