multinma (version 0.1.3)

plot.nma_data: Network plots

Description

Create a network plot from a nma_data network object.

Usage

# S3 method for nma_data
plot(
  x,
  ...,
  layout,
  circular,
  weight_edges = TRUE,
  weight_nodes = FALSE,
  show_trt_class = FALSE
)

Arguments

x

A nma_data object to plot

...

Additional arguments passed to ggraph() and on to the layout function

layout

The type of layout to create. Any layout accepted by ggraph() may be used, including all of the layout functions provided by igraph.

circular

Whether to use a circular representation. See ggraph().

weight_edges

Weight edges by the number of studies? Default is TRUE.

weight_nodes

Weight nodes by the total sample size? Default is FALSE.

show_trt_class

Colour treatment nodes by class, if trt_class is set? Default is FALSE.

Value

A ggplot object, as produced by ggraph().

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_*().

Examples

Run this code
# NOT RUN {
## Stroke prevention in atrial fibrillation
# Setting up the network
af_net <- set_agd_arm(atrial_fibrillation,
                      study = studyc,
                      trt = trtc,
                      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")

# Choosing a different ggraph layout
plot(af_net, weight_nodes = TRUE, show_trt_class = TRUE,
     layout = "star")

# }

Run the code above in your browser using DataLab