BrailleR (version 0.29.1)

SVGThis: Save commonly used graphs as structured SVG files.

Description

Converts a graph object (as long as it has a class assigned) or the current graph window to an SVG file that can be viewed using a browser (not IE) or the Tiger Player software available from ViewPlus Inc. At present, the SVG needs manual editing using the Tiger Transformer software before viewing in the Tiger Player.

Usage

SVGThis(x, file = "test.svg", ...)

Arguments

x

a graph object for which a method exists, or the current graphics device if set to NULL.

file

The SVG file to be created.

...

Arguments to be passed to the methods.

Value

NULL. This function is solely for the purpose of creating SVG files in the current working directory or in a path of the user's choosing.

Details

The Cairo SVG device found in the gr.devices package does not create a structured SVG file that includes the semantics of the graphic being displayed. The SVG created by the gridSVG package does meet this need, but only works on graphs drawn using the grid package. Any graph created using functions from the more common graphics package can be converted to the grid package system using the gridGraphics package.

The SVGThis.ggplot method accepts argument createDevice (default TRUE) - if true the method creates its own null pdf device to draw the graph on, if false it draws on the current device.

References

P. Murrell and S. Potter (2014) “The gridSVG package” The R Journal 6/1, pp. 133-143. http://journal.r-project.org/archive/2014-1/RJournal_2014-1_murrell-potter.pdf

P. Murrell (2015) “The gridGraphics package”, The R Journal 7/1 pp. 151-162. http://journal.r-project.org/archive/2015-1/murrell.pdf

P. Dengler et al. (2011) Scalable vector graphics (SVG) 1.1, second edition. W3C recommendation, W3C. http://www.w3.org/TR/2011/REC-SVG11-20110816/

Examples

Run this code
# NOT RUN {
x=rnorm(1000)
#SVGThis(hist(x))
# }

Run the code above in your browser using DataLab