JPlotToEPS | R Documentation |
Writes the output of a plot to a EPS file. If you are using ggplot, try
either using JPlotToEPS(filename, print(<plotting code>))
or else
ggsave()
.
JPlotToEPS(
filename,
plotExpr,
width = 180,
height = NA,
aspectRatio = 3/2,
units = c("mm", "cm", "in"),
bg = "white",
paper = "special",
family = "Helvetica",
onlyIfDoesntExist = FALSE,
createDirectory = TRUE,
cairo = FALSE,
...
)
filename |
The name of the EPS to create or overwrite. If NULL, plot output goes to the current device. |
plotExpr |
A function or expression which will produce the plot to be written to the file. |
width |
The width of the output EPS file in |
height |
The height of the output EPS file in |
aspectRatio |
Aspect ratio ( |
units |
Units of |
bg |
Background colour - may be "transparent" for no background. |
paper |
Paper size, defaults to "special" which is required if
|
family |
The font family to be used. Passed to
|
onlyIfDoesntExist |
If TRUE and the output file already exists,
|
createDirectory |
If TRUE and |
cairo |
If TRUE, the |
... |
Any additional arguments are passed to
|
R provides two mechanisms (or 'graphics devices') for writing postscript: the
standard device (postscript
) and the Cairo device
(cairo
). The cairo
device is an
alternative implementation for writing postscript that handles transparency,
although it may output a raster bitmap rather than vector data to do so.
Specify a value for the argument fallback_resolution
to define the
resolution of the bitmap. See cairo
for details.
The result of evaluating plotExpr
is returned invisibly (which
means it is not automatically printed).
postscriptFonts
,
postscript
, cairo
## Not run:
plotWithAlpha <- function() {
plot(1:3, type = 'l', lwd = 20, col = "#ffcc8888")
lines(3:1, lwd = 20, col = "#88ccff88")
}
# This will generate a warning and an empty plot due to transparency
JPlotToEPS(filename, plotWithAlpha)
# This will work (more or less) as expected
JPlotToEPS(filename, plotWithAlpha, cairo = TRUE, fallback_resolution = 600)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.