capture_plot: Run some code, capturing an image.

Description Usage Arguments Value Examples

Description

Run some code, capturing an image.

Usage

1
2
capture_plot(name, code, path = get_diff_dir(), dev = "png", width = 250,
  height = 250, ...)

Arguments

name

unique name for plot. Should not include extension

code

to evaluate and print. Printing ensure that capture_plot works well with ggplot2 and lattice graphics.

path

where to save resulting image, defaults to get_diff_dir.

dev

name of graphics device to use, defaults to png.

width,height

dimenion, in pixels, of resulting plot

...

other arguments passed on to the graphics device.

Value

(invisibly) the path of the created file

Examples

1
2
capture_plot("Sequence", plot(1:10))
capture_plot("Random", plot(runif(10)))

hadley/rifftron documentation built on May 17, 2019, 11:31 a.m.