SVG_import: Import an SVG file and create an 'svg' object

Description Usage Arguments Value

View source: R/SVG.R

Description

Import an SVG file and create an svg object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SVG_import(
  data = NULL,
  width = NULL,
  height = NULL,
  viewbox = NULL,
  title = NULL,
  desc = NULL,
  incl_xmlns = FALSE,
  oneline = FALSE,
  anim_iterations = "infinite"
)

Arguments

data

Either a file path to an SVG file or the SVG code itself as a character vector of length 1.

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.

title

The <title> tag for the finalized SVG.

desc

The <desc> tag for the finalized SVG.

incl_xmlns

Should the xmlns attribute be included in the <svg> tag? This attribute is only required on the outermost svg element of SVG documents, and, it's unnecessary for inner svg elements or inside of HTML documents. By default, this is set to FALSE.

oneline

An option to compress the resulting SVG tags such that they are reduced to one line.

anim_iterations

How many should an SVG animation (if defined by use of the anims() function) be played? By default this is "infinite" (i.e., looped indefinitely) but we can specify the animation iteration count as a positive number.

Value

An svg object.


rich-iannone/omsvg documentation built on March 11, 2021, 5:13 p.m.