set_attributes: Change attributes of an imported SVG file

View source: R/set_attributes.R

set_attributesR Documentation

Change attributes of an imported SVG file

Description

SVG files and the imported representation of class 'XMLsvg' are hierarchically organized in node sets and nodes. Each node is a graphical object such as a path, rectangle, or text. The attributes of these nodes can be changed with this function. Note that even when the output of set_attributes() is not assigned to a new object, the input 'XMLsvg' object is still changed. This is because, unlike usual R work flows, attributes of XML objects are changed on the fly (similar to python).

Usage

set_attributes(
  xml,
  node = NULL,
  node_attr = "label",
  attr = NULL,
  pattern = NULL,
  replacement = NULL,
  verbose = TRUE
)

Arguments

xml

(XMLsvg) XMLsvg object obtained from 'read_svg()'

node

(character) node(s) to be modified. Node names are searched using the 'node_attr' field

node_attr

(character) name of the attribute by which target nodes are filtered (default: "label")

attr

(character) the desired attribute to be displayed, such as 'id', 'style'

pattern

(character) (sub-) string of the attribute value to be modified

replacement

(character) string that is used as replacement for 'pattern'

verbose

(logical) print messages about the number of changed nodes

Value

Returns an object of class 'XMLsvg'


m-jahn/fluctuator documentation built on Nov. 4, 2024, 9:35 p.m.