JPlotToSVG | R Documentation |
Writes the output of a plot to a SVG file. If you are using ggplot, try either
using JPlotToSVG(filename, print(<plotting code>))
or else
ggsave()
.
JPlotToSVG(
filename,
plotExpr,
width = 180,
height = NA,
aspectRatio = 3/2,
units = c("mm", "cm", "in"),
bg = "white",
family = "Helvetica",
onlyIfDoesntExist = FALSE,
createDirectory = TRUE,
...
)
filename |
The name of the SVG file 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 SVG file in |
height |
The height of the output SVG file in |
aspectRatio |
Aspect ratio ( |
units |
Units of |
bg |
Background colour - may be "transparent" for no background. |
family |
The font family to be used. Passed to
|
onlyIfDoesntExist |
If TRUE and the output file already exists,
|
createDirectory |
If TRUE and |
... |
Any additional arguments are passed to
|
The result of evaluating plotExpr
is returned invisibly (which
means it is not automatically printed).
cairo
## Not run:
plotWithAlpha <- function() {
plot(1:3, type = 'l', lwd = 20, col = "#ffcc8888")
lines(3:1, lwd = 20, col = "#88ccff88")
}
JPlotToSVG(filename, plotWithAlpha)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.