Network plots
Create a network plot from a nma_data
network object.
## S3 method for class 'nma_data' plot( x, ..., layout, circular, weight_edges = TRUE, weight_nodes = FALSE, show_trt_class = FALSE )
x |
A nma_data object to plot |
... |
Additional arguments passed to |
layout |
The type of layout to create. Any layout accepted by |
circular |
Whether to use a circular representation. See |
weight_edges |
Weight edges by the number of studies? Default is |
weight_nodes |
Weight nodes by the total sample size? Default is |
show_trt_class |
Colour treatment nodes by class, if |
The default is equivalent to layout = "linear"
and circular = TRUE
, which places the treatment nodes on a circle in the order defined by
the treatment factor variable. An alternative layout which may give good
results for simple networks is "sugiyama"
, which attempts to minimise the
number of edge crossings.
weight_nodes = TRUE
requires that sample sizes have been specified for
any aggregate data in the network, using the sample_size
option of
set_agd_*()
.
A ggplot
object, as produced by ggraph()
.
## Stroke prevention in atrial fibrillation # Setting up the network af_net <- set_agd_arm(atrial_fibrillation, study = studyc, trt = abbreviate(trtc, minlength = 3), r = r, n = n, trt_class = trt_class) af_net # Basic plot plot(af_net) # Turn off weighting edges by number of studies plot(af_net, weight_edges = FALSE) # Turn on weighting nodes by sample size plot(af_net, weight_nodes = TRUE) # Colour treatment nodes by class plot(af_net, weight_nodes = TRUE, show_trt_class = TRUE) # Output may be customised using standard ggplot commands # For example, to display the legends below the plot: plot(af_net, weight_nodes = TRUE, show_trt_class = TRUE) + ggplot2::theme(legend.position = "bottom", legend.box = "vertical", legend.margin = ggplot2::margin(0, 0, 0, 0), legend.spacing = ggplot2::unit(0.5, "lines")) # Choosing a different ggraph layout, hiding some legends plot(af_net, weight_nodes = TRUE, show_trt_class = TRUE, layout = "star") + ggplot2::guides(edge_width = "none", size = "none")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.