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)
A required list of data frames returned from the
prepare_diagram
function and, optionally, updated with
update_diagram
. See those functions for details
about this object.
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.
A ggplot2 object.
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.
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)