View source: R/set_attributes.R
set_attributes | R Documentation |
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).
set_attributes(
xml,
node = NULL,
node_attr = "label",
attr = NULL,
pattern = NULL,
replacement = NULL,
verbose = TRUE
)
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 |
Returns an object of class 'XMLsvg'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.