Skip to contents

Convert a model specification into a graph (using the graph package) that can be plotted with Rgraphviz: see ?Rgraphviz::plot.graphNEL and https://graphviz.org/doc/info/attrs.html for information on customizing the plot.

Usage

dot_layout(spec, include_inout = FALSE)

Arguments

spec

a model specification

include_inout

(logical) include nodes defined by mp_per_capita_inflow and mp_per_capita_outflow ?

Details

In order to plot the graph, you need to have loaded the Rgraphviz package (library("Rgraphviz")).

Examples

if (require(Rgraphviz)) {
  macpan_base = mp_tmb_library("starter_models", "macpan_base", package = "macpan2")
  ## plot with left-to-right layout, rectangles instead of default circles
  dot_layout(macpan_base) |>
    plot(attrs = list(graph = list(rankdir = "LR"),
                      node = list(shape = "rectangle")))
}
#> Loading required package: Rgraphviz
#> Loading required package: graph
#> Loading required package: BiocGenerics
#> 
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table,
#>     tapply, union, unique, unsplit, which.max, which.min
#> Loading required package: grid