save.plot {StabPerf}R Documentation

Captures the output of the 'plot' function into a graphics file.

Description

Wraps around the plot function and captures the graphic that is produced to an image file in a user-supplied format.

Usage

save.plot(cmd, file="plot.png", prefix="my", dir=getwd(),
 w=720, h=720, format="png")

Arguments

cmd character. The command which should be sucked into a graphic, e.g. plot()
dir character. Where to save the file, if not the current directory
prefix character. Filename prefix (separted from file name by _)
file character. The base filename, e.g. plot.png
w numeric. Width of the graphic
h numeric. Height of the graphic
format character. png or jpeg

Details

Note: this function does not open any windows to plotting graphics on the screen, but because the graphics devices in R require access to a graphics device, it is not possible to execute this function successfully with an attached real graphics device (e.g. a running X-erver). In order to fun this function from scripts or background jobs, using a virtual X-server, such as Xvfb or VNC, is recommended.

You may set any par parameters you like and do not need to save them or revert to previous values, which is done automatically by this function.

See Also

plot, png, jpeg

Examples

# Save the result of a standard plot into ./plots/run1_random.png
save.plot(plot(rnorm(1:10), rnorm(1:10)),
 file="random.png", prefix="run1", dir="plots")

[Package StabPerf version 0.5 Index]