JPlotToPDF | R Documentation |
Writes the output of a plot to a PDF file. If you are using ggplot, try
either using JPlotToPDF(filename, print(<plotting code>))
or else
ggsave()
.
JPlotToPDF(
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,
embedFonts = FALSE,
...
)
filename |
The name of the PDF 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 PDF file in |
height |
The height of the output PDF 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 the value it must
have if |
family |
The font family to be used. Consider using |
onlyIfDoesntExist |
If TRUE and the output file already exists,
|
createDirectory |
If TRUE and |
cairo |
If TRUE, the |
embedFonts |
If TRUE, |
... |
Any additional arguments are passed to
|
The pdf
argument pointsize
can be specified
to control the resolution of the image (as can all other arguments to
pdf
.)
The pdf device does not embed fonts in the pdf file. This probably
does not matter if you use one of the device-independent font families,
"sans"
, "serif"
and "mono"
, because an appropriate (but
not necessarily identical) font will be used by the viewer. Alternatively,
specifying cairo = TRUE
may embed the font, although the
documentation for cairo_pdf
is confusing.
The result of evaluating plotExpr
is returned invisibly (which
means it is not automatically printed).
pdf
, cairo_pdf
,
embedFonts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.