qdraw {io} | R Documentation |
Draw plot
Description
This funtion draws a plot to screen, a file, or both.
Usage
qdraw(
expr,
file = NULL,
device = getOption("plot.device"),
width = NULL,
height = NULL,
aspect.ratio = NULL,
units = NULL,
res = NULL,
mkpath = TRUE,
symlink = TRUE,
...
)
Arguments
expr |
expression for plotting |
file |
filename |
device |
plot device |
width |
plot width [default: 5] |
height |
plot height [default: 5] |
aspect.ratio |
ratio of width to height |
units |
unit of plot dimension [default: "in"] |
res |
bitmap resolution, used only by bitmap formats [default: 300] |
mkpath |
whether to create parent directories (if they do not already exists) |
symlink |
whether to create a symlink to file with a simplified
filename (ignored if file is not a |
... |
other arguments passed to the plot device function |
Details
To send the plot to screen, set device
to NA (default).
Optionally, to print the plot on screen to a file, specify file
.
If device
is NULL
, the plot will be sent directly to the
the specified file
using a printing device inferred from the file
extension (no graphical window will open).
Set the global option plot.device
to affect multiple plots.
Graphical parameters including width
, height
, res
,
units
are obtained from the global option getOption("plot")
.
Examples
## Not run:
# Set device to jpeg (remember to update file extensions for printed plots)
options(plot.device=jpeg)
qdraw(plot(1:10), "plot.jpeg")
# Enable automatic plot format inference
options(plot.device=NULL)
# Plot directly to file (format is inferred from filename extension)
qdraw(plot(1:10), "plot.pdf")
# Plot to screen, then print to file (display will not be closed)
qdraw(plot(1:10), "plot.png", device=NA)
# If an error occurs, be sure to clear the current plot
dev.off()
# or clear all plots
graphics.off()
## End(Not run)