| plot.sdbuildR_xmile | R Documentation |
Visualize a stock-and-flow diagram using the R package DiagrammeR. Stocks are represented as boxes. Flows are represented as arrows between stocks and/or double circles, where the latter represent what it outside of the model boundary. Thin grey edges indicate dependencies between variables. By default, constants (indicated by italic labels) are not shown. Hover over the variables to see their equations.
## S3 method for class 'sdbuildR_xmile'
plot(
x,
vars = NULL,
format_label = TRUE,
wrap_width = 20,
font_size = 18,
font_family = "Times New Roman",
stock_col = "#83d3d4",
flow_col = "#f48153",
dependency_col = "#999999",
show_dependencies = TRUE,
show_constants = FALSE,
show_aux = TRUE,
minlen = 2,
...
)
x |
A stock-and-flow model object of class |
vars |
Variables to plot. Defaults to NULL to plot all variables. |
format_label |
If TRUE, apply default formatting (removing periods and underscores) to labels if labels are the same as variable names. |
wrap_width |
Width of text wrapping for labels. Must be an integer. Defaults to 20. |
font_size |
Font size. Defaults to 18. |
font_family |
Font name. Defaults to "Times New Roman". |
stock_col |
Colour of stocks. Defaults to "#83d3d4". |
flow_col |
Colour of flows. Defaults to "#f48153". |
dependency_col |
Colour of dependency arrows. Defaults to "#999999". |
show_dependencies |
If TRUE, show dependencies between variables. Defaults to TRUE. |
show_constants |
If TRUE, show constants. Defaults to FALSE. |
show_aux |
If TRUE, show auxiliary variables. Defaults to TRUE. |
minlen |
Minimum length of edges; must be an integer. Defaults to 2. |
... |
Optional arguments |
Stock-and-flow diagram
insightmaker_to_sfm(), xmile(), plot.sdbuildR_sim()
sfm <- xmile("SIR")
plot(sfm)
# Don't show constants or auxiliaries
plot(sfm, show_constants = FALSE, show_aux = FALSE)
# Only show specific variables
plot(sfm, vars = "Susceptible")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.