Skip to contents

Export a network plot at explicit publication dimensions

Usage

network_plot_export(
  plot,
  file,
  width = 10,
  height = 7,
  dpi = 300,
  family = "sans"
)

Arguments

plot

A zero-argument function that draws the plot.

file

Output filename ending in pdf, png, or svg.

width, height

Device dimensions in inches.

dpi

PNG resolution.

family

Font family, default sans, applied consistently across devices.

Value

Invisibly returns the output filename. The device is closed on errors.

Examples

dat <- data.frame(study = 1:6, a = rep(c("A", "A", "B"), 2),
                  b = rep(c("B", "C", "C"), 2),
                  yi = c(.2, .5, .3, .3, .6, .4), vi = .04)
fit <- network_meta(dat, "study", "a", "b", "yi", "vi")

path <- tempfile(fileext = ".pdf")
network_plot_export(function() network_rank_plot(fit, "higher", nsim = 500), path)
file.exists(path)
#> [1] TRUE
unlink(path)