Built as a wrapper around ggsave, this function facilitates the export of xpose plots.

xpose_save(
  plot = last_plot(),
  file = NULL,
  dir = NULL,
  device = NULL,
  scale = 1,
  width = 7,
  height = 6,
  units = c("in", "cm", "mm", "px"),
  dpi = 200,
  limitsize = TRUE,
  bg = NULL,
  ...
)

Arguments

plot

A xpose plot object.

file

A name with file extension (if device is NULL) to be given to the output file. Template variables such as @run (run number) and @plotfun (plot function) can be used to automatically name files e.g. file = '@run_@plotfun.pdf'.

dir

Directory under which the xpose plots will be saved. Template variables such as @dir can be used to generate template names.

device

Graphical device to use. Can be either be a device function (e.g. png), or one of 'eps', 'ps', 'tex' (pictex), 'pdf', 'jpeg', 'tiff', 'png', 'bmp', 'svg' or 'wmf' (windows only).

scale

Multiplicative scaling factor.

width, height, units

Plot size in in units ("in", "cm", "mm", or "px"). If not supplied, uses the size of current graphics device.

dpi

Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.

limitsize

When TRUE (the default), xpose_save() will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.

bg

Background color. If NULL, uses the plot.background fill value from the plot theme.

...

Other arguments passed on to the graphics device function, as specified by device.

Examples

if (FALSE) {
xpdb_ex_pk %>%
 dv_vs_ipred() %>%
 xpose_save(file = file.path(tempdir(), "dv_vs_ipred_example.pdf"))
}