Plots a PM_model based on differential equations using network plots from tidygraph and ggraph packages.
Usage
# S3 method for PM_model
plot(x, marker = TRUE, line = TRUE, explicit, implicit, ...)Arguments
- x
The name of an PM_model object.
- marker
Controls the characteristics of the compartments (nodes). It can be boolean or a list.
TRUEwill plot the compartments with default characteristics.FALSEwill suppress compartment plotting. If a list, can control some marker characteristics, including overriding defaults. These include:colorMarker color (default: dodgerblue).opacityRanging between 0 (fully transparent) to 1 (fully opaque). Default is 0.5.sizeRelative size of boxes, ranging from 0 to 1. Default is 0.25.lineA list of additional attributes governing the outline for filled shapes, most commonly color (default: black) and width (default: 0.5).
Example:marker = list(color = "red", opacity = 0.8, line = list(color = "black", width = 1))- line
Controls characteristics of arrows (edges).
TRUEwill plot default lines.FALSEwill suppress lines. If a list, can control some line characteristics, including overriding defaults. These include:colorLine color (default: black)widthThickness in points (default: 1).
Example:line = list(color = "red", width = 2)- explicit
A data frame or tibble containing two columns named
fromandtoto add additional connecting arrows to the plot indicating transfer between compartments. For each row, thefromcolumn contains the compartment number of the arrow origin, and thetocolumn contains the compartment number of the arrow destination. Use 0 to indicate a destination to the external sink. e.g.,explicit = data.frame(from = 3, to = 0)- implicit
Similar to
explicit, used to add dashed connecting arrows to the plot indicating implicit transfer between compartments. For each row, thefromcolumn contains the compartment number of the arrow origin, and thetocolumn contains the compartment number of the arrow destination. Use 0 to indicate a destination to the external sink. e.g.,implicit = data.frame(from = 2, to = 4)- ...
Not used.
Details
This accepts a PM_model object and creates a network plot where nodes are compartments and edges are arrows connecting compartments.
See also
PM_model, ggraph::ggraph(), ggplot2::ggplot()
Other PMplots:
plot.MMopt(),
plot.PM_cov(),
plot.PM_cycle(),
plot.PM_data(),
plot.PM_final(),
plot.PM_op(),
plot.PM_pta(),
plot.PM_sim(),
plot.PM_valid()
Examples
library(PmetricsData)
NPex$model$plot()
