The SVG_t()
function is a variation on SVG()
(the entry point for
building an SVG) in that the output tags will be both as compact as possible
(fewer linebreaks, less space characters) and the height is relative to line
height of text (at "0.75em"
). This is a good option if the eventual use for
the generated SVG is to be integrated with text in HTML <p>
elements. For
scaling to function properly, the provision of the viewbox
is required
here.
SVG_t(height = "0.75em", viewbox)
height | The height attribute on the top-level |
---|---|
viewbox | An optional set of dimensions that defines the SVG |
# Create a simple SVG with a rectangle and a circle SVG_t(viewbox = c(0, 0, 60, 20)) %>% svg_rect(x = 0, y = 0, width = 30, height = 20) %>% svg_circle(x = 50, y = 10, diameter = 20)#>