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, level = c("treatment","class"), nudge =0)
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.
level: Display network at the "treatment" (default) or "class" level.
nudge: Numeric value to nudge the treatment labels away from the nodes when weight_nodes = TRUE. Default is 0 (no adjustment to label position). A small value like 0.1 is usually sufficient.
Returns
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
## Stroke prevention in atrial fibrillation# Setting up the networkaf_net <- set_agd_arm(atrial_fibrillation, study = studyc, trt = abbreviate(trtc, minlength =3), r = r, n = n, trt_class = trt_class)af_net
# Basic plotplot(af_net)# Turn off weighting edges by number of studiesplot(af_net, weight_edges =FALSE)# Turn on weighting nodes by sample sizeplot(af_net, weight_nodes =TRUE)# Colour treatment nodes by classplot(af_net, weight_nodes =TRUE, show_trt_class =TRUE)# Nudge the treatment labels away from the nodesplot(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 legendsplot(af_net, weight_nodes =TRUE, show_trt_class =TRUE, layout ="star")+ ggplot2::guides(edge_width ="none", size ="none")