dsvg | R Documentation |
This function produces SVG files (compliant to the current w3 svg XML standard) where elements can be made interactive.
In order to generate the output, used fonts must be available on the computer used to create the svg, used fonts must also be available on the computer used to render the svg.
dsvg(
file = "Rplots.svg",
width = 6,
height = 6,
bg = "white",
pointsize = 12,
standalone = TRUE,
setdims = TRUE,
canvas_id = "svg_1",
title = NULL,
desc = NULL,
fonts = list()
)
file |
the file where output will appear. | |||||||||||||||||||||
height , width |
Height and width in inches. | |||||||||||||||||||||
bg |
Default background color for the plot (defaults to "white"). | |||||||||||||||||||||
pointsize |
default point size. | |||||||||||||||||||||
standalone |
Produce a stand alone svg file? If | |||||||||||||||||||||
setdims |
If | |||||||||||||||||||||
canvas_id |
svg id within HTML page. | |||||||||||||||||||||
title |
A label for accessibility purposes (aria-label/aria-labelledby). Be aware that when using this, the browser will use it as a tooltip for the whole svg and it may class with the interactive elements' tooltip. | |||||||||||||||||||||
desc |
A longer description for accessibility purposes (aria-description/aria-describedby). | |||||||||||||||||||||
fonts |
Named list of font names to be aliased with
fonts installed on your system. If unspecified, the R default
families "sans", "serif", "mono" and "symbol"
are aliased to the family returned by If fonts are available, the default mapping will use these values:
As an example, using You can also use theme_minimal(base_family="Roboto"). |
Devices
fileout <- tempfile(fileext = ".svg")
dsvg(file = fileout)
plot(rnorm(10), main="Simple Example", xlab = "", ylab = "")
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.