grid.export | R Documentation |
Produces an SVG version of the current grid page.
grid.export(name = "Rplots.svg",
exportCoords = c("none", "inline", "file"),
exportMappings = c("none", "inline", "file"),
exportJS = c("none", "inline", "file"),
res = NULL,
prefix = "",
addClasses = FALSE,
indent = TRUE,
htmlWrapper = FALSE,
usePaths = c("vpPaths", "gPaths", "none", "both"),
uniqueNames = TRUE,
annotate = TRUE,
progress = FALSE,
compression = 0,
strict = TRUE,
rootAttrs = NULL,
xmldecl = xmlDecl())
name |
The name of the SVG file to produce. If this parameter is |
exportCoords |
If this parameter is not If this parameter is |
exportMappings |
If this parameter is not If this parameter is |
exportJS |
If this parameter is not If this parameter is |
res |
The device resolution to print at (in DPI). If |
prefix |
A prefix to apply to all generated SVG ID attributes. Useful for ensuring unique IDs when many SVG images exist within the same HTML document. If a valid prefix has been given, the root |
addClasses |
If |
indent |
Determines whether the resulting SVG document will be exported with indentation present. Indentation makes the document more readable, but when |
htmlWrapper |
If |
usePaths |
If this parameter is set to If this parameter is set to When When |
uniqueNames |
If |
annotate |
If |
progress |
If |
compression |
An integer between 0 and 9 indicating the level of (gzip)
compression applied to the SVG image when it is saved to a
file. Higher values of |
strict |
A logical indicating whether checks should be made that all
attributes added to SVG elements are valid. If this is
|
rootAttrs |
A named character vector containing attributes for the top-level
|
xmldecl |
This parameter sets the XML declaraction that will be applied to the SVG document. By default this parameter simply declares that the document is XML version 1.0, along with the character encoding that was used to export the SVG document. If |
The uniqueNames
parameter is set to TRUE
by default in
order to ensure that each SVG element ID is unique. This is a
requirement of XML (which SVG is based on). This differs from
usePaths
because usePaths
can still generate names that
are not unique (there are several ways for this to
happen). uniqueNames
modifies grob and viewport names with a
numeric suffix to ensure uniqueness. When FALSE
, only grob
names will be kept unmodified because modifying viewport names would
affect coordinate information.
Occasionally the XML package can report warnings, despite valid SVG
being produced. If spurious warnings are being produced, set
options(gridSVGWarnings = FALSE)
to ignore them.
See the files in the directory gridSVG/tests for examples of things that can be done. See the file gridSVG/doc/overview.tex for limitations.
When name
has a valid filename the side effect is to produce an
SVG file of the specified name.
Optionally a JavaScript file containing coordinate transformation information is also exported.
Optionally a JavaScript file containing name mapping information is also exported.
Optionally a JavaScript file containing utility JavaScript functions is also exported.
When name
has a filename with zero characters, a named list is
returned with four elements. svg
is the SVG root node (and all
its children, see the XML package for more information on how to use
this. coords
contains the list of coordinate information for
exported viewports. mappings
is a list containing information
on how names have been modified during the exporting process.
utils
is a character vector containing JavaScript code to
manipulate gridSVG plots in the browser.
This list is always returned but when a valid filename is given, it is returned invisibly.
Paul Murrell
grid.hyperlink
, grid.animate
, grid.garnish
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.