The SVG_()
function is a variation on SVG()
(the entry point for building
an SVG) in that the output tags will be as compact as possible (fewer
linebreaks, less space characters). This is a reasonable option if the
eventual use for the generated SVG is as inline SVG within HTML documents.
SVG_(width = NULL, height = NULL, viewbox = TRUE)
Arguments
width |
The width and height attributes on the top-level <svg>
element. Both of these attributes are optional but, if provided, take in a
variety of dimensions and keywords. If numerical values are solely used,
they are assumed to be 'px' length values. Dimensions can be percentage
values (i.e., "75%" ) or length values with the following units: "em" ,
"ex" , "px" , "in" , "cm" , "mm" , "pt" , and "pc" . Using NULL ,
the default, excludes the attribute. |
height |
The width and height attributes on the top-level <svg>
element. Both of these attributes are optional but, if provided, take in a
variety of dimensions and keywords. If numerical values are solely used,
they are assumed to be 'px' length values. Dimensions can be percentage
values (i.e., "75%" ) or length values with the following units: "em" ,
"ex" , "px" , "in" , "cm" , "mm" , "pt" , and "pc" . Using NULL ,
the default, excludes the attribute. |
viewbox |
An optional set of dimensions that defines the SVG viewBox
attribute. The viewBox for an SVG element is the position and dimension,
in user space, of an SVG viewport. If supplied, this could either be in the
form of a four-element, numeric vector corresponding to the "min-x" ,
"min-y" , "width" , and "height" of the rectangle, or, as TRUE which
uses the vector c(0, 0, width, height) . Using NULL , the default,
excludes this attribute. |
Examples
#> <svg width="100" height="50" viewBox="0 0 100 50"><rect x="0" y="0" width="30" height="20"/><circle cx="50" cy="10" r="10"/></svg>