svgstring {svglite} | R Documentation |
Access current SVG as a string.
Description
This is a variation on svglite
that makes it easy to access
the current value as a string.
Usage
svgstring(
width = 10,
height = 8,
bg = "white",
pointsize = 12,
standalone = TRUE,
system_fonts = list(),
user_fonts = list(),
web_fonts = list(),
id = NULL,
fix_text_size = TRUE,
scaling = 1
)
Arguments
height , width |
Height and width in inches. |
bg |
Default background color for the plot (defaults to "white"). |
pointsize |
Default point size. |
standalone |
Produce a standalone svg file? If |
system_fonts |
Consider using
|
user_fonts |
Consider using
|
web_fonts |
A list containing web fonts to use in the SVG. The fonts
will still need to be available locally on the computer running the code,
but viewers of the final SVG will not need the font if specified as a web
font. Web fonts can either be specified using |
id |
A character vector of ids to assign to the generated SVG's. If creating more SVG files than supplied ids the exceeding SVG's will not have an id tag and a warning will be thrown. |
fix_text_size |
Should the width of strings be fixed so that it doesn't
change between svg renderers depending on their font rendering? Defaults to
|
scaling |
A scaling factor to apply to the rendered line width and text size. Useful for getting the right sizing at the dimension that you need. |
Details
See svglite()
documentation for information about
specifying fonts.
Value
A function with no arguments: call the function to get the current value of the string.
Examples
s <- svgstring()
s()
plot.new()
s()
text(0.5, 0.5, "Hi!")
s()
dev.off()
s <- svgstring()
plot(rnorm(5), rnorm(5))
s()
dev.off()