Learn R Programming

gridSVG (version 1.0-1)

gridToSVG: Generate SVG output from a grid graphic

Description

Produces an SVG version of the current grid page.

Usage

gridToSVG(name = "Rplots.svg",
          export.coords = c("file", "inline", "none"),
          export.js = c("file", "inline", "none"),
          res = NULL,
          indent = TRUE,
          xmldecl = xmlDecl())

Arguments

name
The name of the SVG file to produce.

If this parameter is NULL or "", a list containing the SVG document, coordinate information, and JavaScript utility functions are returned.

export.coords
If this parameter is not none a coordinates file is exported.

If this parameter is file, the coordinates information is written to a file, while inline will include the contents within the SVG document.

export.js
If this parameter is not none a JavaScript file is written out. This contains useful functions for manipulating gridSVG plots in the browser, including unit conversion functions.

If this parameter is file, the JavaSc

res
The device resolution to print at (in DPI).

If NULL, this is automatically calculated to be the resolution of the current device. Typically the PDF device would be used, and this uses a resolution of 72, i.e. 72 DPI.

indent
Determines whether the resulting SVG document will be exported with indentation present.

Indentation makes the document more readable, but when indent is set to FALSE, parsing the SVG in JavaScript is easier beca

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.

Value

  • When name has a valid filename, nothing is returned. The side effect is to produce an SVG file of the specified name, AND a very rudimentary HTML file with the SVG document embedded.

    Optionally a JavaScript file containing coordinate transformation 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 three 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. utils is a character vector containing JavaScript code to manipulate gridSVG plots in the browser.

Details

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.

See Also

grid.hyperlink, grid.animate