| plot.nma_data {multinma} | R Documentation |
Network plots
Description
Create a network plot from a nma_data network object.
Usage
## S3 method for class 'nma_data'
plot(
x,
...,
layout,
circular,
weight_edges = TRUE,
weight_nodes = FALSE,
show_trt_class = FALSE,
nudge = 0
)
Arguments
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 |
nudge |
Numeric value to nudge the treatment labels away from the nodes
when |
Details
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_*().
Value
A ggplot object, as produced by ggraph().
Examples
## 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)
# Nudge the treatment labels away from the nodes
plot(af_net, weight_nodes = TRUE, show_trt_class = TRUE, nudge = 0.1)
# 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")