Description Usage Arguments Value Examples
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.
1 |
height |
The height attribute on the top-level |
viewbox |
An optional set of dimensions that defines the SVG |
An svg
object.
1 2 3 4 5 6 7 8 | if (interactive()) {
# Create a simple SVG with a rectangle and a circle
svg <-
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.