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.
TRUE
will plot the compartments with default characteristics.FALSE
will suppress compartment plotting. If a list, can control some marker characteristics, including overriding defaults. These include:color
Marker color (default: dodgerblue).opacity
Ranging between 0 (fully transparent) to 1 (fully opaque). Default is 0.5.size
Relative size of boxes, ranging from 0 to 1. Default is 0.25.line
A 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).
TRUE
will plot default lines.FALSE
will suppress lines. If a list, can control some line characteristics, including overriding defaults. These include:color
Line color (default: black)width
Thickness in points (default: 1).
Example:line = list(color = "red", width = 2)
- explicit
A data frame or tibble containing two columns named
from
andto
to add additional connecting arrows to the plot indicating transfer between compartments. For each row, thefrom
column contains the compartment number of the arrow origin, and theto
column 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, thefrom
column contains the compartment number of the arrow origin, and theto
column 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()