plotf(theplot, file="plot%03d", type=c("active"), size=c(6,4,10,96), prepare=a.resetplotparams, ...)
expression
such as expression(plot(x), points(pp))
or a
Lattice object such as xyplot(y~x)
.
The object will be eval
-uated (if an expression) or
print
-ed (if a Lattice object) once on each device to be used.
Note that this repeated processing may be inefficient if the plotting
process itself (rather than just the resulting plot) is extremely complex.
In such (rare) cases, you may want to
consider manually using dev.print
instead.
plotf
uses repeated processing rather than dev.print
to ensure that the plotting function works
as intended even if it discriminates between different devices.
.eps, .ps, .pdf, .png, .jpg
, or .wmf
, respectively,
will be appended for the actual files produced.
The filename is ignored for the "active"
device.
"active", "current", "eps", "ps", "pdf",
"png", "jpg", "jpeg", "wmf"
and they represent the use of
dev.cur, dev.cur, dev.copy2eps, postscript, pdf, png, jpeg,
jpeg
, and win.metafile
, respectively.
"eps"
is ignored unless "active"
(or "current"
)
is also present.
width
and height
arguments, respectively.
Component 3 is the base character size and will be supplied to the
pointsize
argument. For the bitmap devices, it will be corrected
for resolution (which is indicated (in dpi) by component 4), because those
devices always assume a resolution of 72dpi. Component 4 will also be
supplied as the res
argument to the bitmap devices.
on.exit
to close a device correctly even if
the plot function fails.
png is almost always preferable to jpeg.
Note that expressions can contain multiple calls by separating them
with commas.
a.resetplotparams
,
dev.cur
,
dev.copy2eps
,
postscript
,
pdf
,
png
,
jpeg
.
x = runif(40)*4
y = x + runif(40)
plotf(expression(plot(x, y, type="p"))) # plots to active device only
plotf(xyplot(y~x), "myplot", type=c("active", "png", "pdf"), size=c(3,3))
Run the code above in your browser using DataLab