save.plot {StabPerf} | R Documentation |
Wraps around the plot
function and captures the graphic that is produced to an image file in a user-supplied format.
save.plot(cmd, file="plot.png", prefix="my", dir=getwd(), w=720, h=720, format="png")
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 |
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.
# 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")